Files
core/test/rust/native/settings.dever
T
2026-11-27 06:03:56 +00:00

39 lines
1.2 KiB
Plaintext

type Banner { title: Text, details: List<Text>, count: Int >= 1 }
type State { Active, Paused }
setting banner: Banner
setting names: List<Text>
setting optional: Text?
setting state: State
readSize() (out: Int) { out = length(banner.title) + length(names) }
copyTitle() (out: Text) { out = banner.title }
copyBanner() (out: Banner) { out = banner }
copyNames() (out: List<Text>) { out = names }
nullable() (out: Text?) { out = optional }
mode() (out: State) { out = state }
measure() (out: Int >= 1) { out = banner.count }
select(value: Int) (out: Int) { out = value + readSize() }
apply(value: Int, action: handler(value: Int) (out: Int)) (out: Int) { out = action(value) }
viaHandler(value: Int) (out: Int) { out = apply(value, select) }
flow start() (out: Int)
| step | kind | do |
| out | calc | readSize() |
loop sizes(n: Int) (out: Int)
| each value in range(0, n) | result |
| out | sum select(value) |
plain(value: Int) (out: Int) { out = value }
aliasTitle() (out: Text) {
first = banner
second = first
out = second.title
}
changed() (out: Banner) {
out = banner
out.title = "new"
}
present() (out: Text) {
value = optional
check value != null else Invalid
out = value
}