StructOp/rust
Use the shared application language with a Rust toolchain.
RustOfficial providerPublished by StructOp
Use this provider
Add this declaration to your project and run structop init. Registry access and version locks
intent.st
structop {
type_app { exec = { lang = "Rust" } }
lib_provider {
package = { source = "StructOp/rust", version = "2.2.1" }
}
}
Example
Print a greeting in Rust
Declaration reference
ability "prompt"
| Name | Type | Use |
|---|
| prompt | String | Required |
| response | VarRef String | Required |
| max_length | Length | Optional · default = auto |
ability "print"
| Name | Type | Use |
|---|
| message | String | Required |
ability "scan"
| Name | Type | Use |
|---|
| source | Expression String | Required |
| pattern | String | Required |
| matched | VarRef Int | Optional |
ability "set"
| Name | Type | Use |
|---|
| target | VarRef | Required |
| value | Expression (matches target) | Required |
ability "if"
| Name | Type | Use |
|---|
| condition | Expression Bool | Required |
| then | AbilityList | Required |
| else | AbilityList | Optional |
ability "loop"
| Name | Type | Use |
|---|
| condition | Expression Bool | Required |
| body | AbilityList | Required |
| check | Keyword | Optional · default = "before" |
ability "for"
| Name | Type | Use |
|---|
| counter | VarRef | Required |
| from | Expression (matches counter) | Required |
| while | Expression Bool | Required |
| next | Expression (matches counter) | Required |
| body | AbilityList | Required |
ability "switch"
| Name | Type | Use |
|---|
| value | Expression | Required |
| cases | CaseList | Required |
| default | AbilityList | Optional |
ability "break"
No attributes.
ability "continue"
No attributes.
ability "function"
| Name | Type | Use |
|---|
| returns | Type | Optional |
| params | ParamList | Optional |
| locals | ParamList | Optional |
| body | AbilityList | Optional |
| return | Expression | Optional |
ability "call"
| Name | Type | Use |
|---|
| function | AbilityRef | Required |
| args | ExpressionList | Optional |
| result | VarRef | Optional |
ability "return"
| Name | Type | Use |
|---|
| value | Expression | Optional |
ability "store"
| Name | Type | Use |
|---|
| pointer | VarRef Pointer | Required |
| value | Expression (matches pointer) | Required |
ability "append"
| Name | Type | Use |
|---|
| target | VarRef | Required · buffer = true |
| value | Expression String | Required |
ability "put_number"
| Name | Type | Use |
|---|
| target | VarRef Bytes | Required |
| at | Expression | Required |
| value | Expression | Required |
| order | Keyword | Required |
ability "add"
| Name | Type | Use |
|---|
| list | VarRef | Required · list = true |
| value | Expression (matches list) | Required |
ability "trim"
| Name | Type | Use |
|---|
| target | VarRef | Required · buffer = true |
ability "random"
| Name | Type | Use |
|---|
| target | VarRef Int | Required |
| from | Expression Int | Required |
| to | Expression Int | Required |
ability "lower"
| Name | Type | Use |
|---|
| target | VarRef | Required · buffer = true |
ability "open"
| Name | Type | Use |
|---|
| path | Expression String | Required |
| mode | Keyword | Required |
| file | VarRef File | Required |
| body | AbilityList | Required |
| else | AbilityList | Optional |
ability "read"
| Name | Type | Use |
|---|
| file | VarRef File | Required |
| target | VarRef Char | Required |
| at_end | AbilityList | Optional |
ability "read_line"
| Name | Type | Use |
|---|
| file | VarRef File | Optional |
| target | VarRef | Required · buffer = true |
| at_end | AbilityList | Optional |
ability "write"
| Name | Type | Use |
|---|
| file | VarRef File | Required |
| message | String | Required |
ability "put"
| Name | Type | Use |
|---|
| file | VarRef File | Required |
| byte | Expression Int | Required |
ability "seek"
| Name | Type | Use |
|---|
| file | VarRef File | Required |
| offset | Expression Int | Required |
| from | Keyword | Optional · default = "current" |
ability "type"
| Name | Type | Use |
|---|
| is | Type | Required |
ability "enum"
| Name | Type | Use |
|---|
| values | NameList | Required |
ability "struct"
| Name | Type | Use |
|---|
| fields | FieldList | Required |
ability "class"
| Name | Type | Use |
|---|
| fields | FieldList | Required |
| methods | AbilityRefList | Optional |
| implements | AbilityRefList | Optional |
ability "interface"
| Name | Type | Use |
|---|
| methods | SignatureList | Required |
ability "define"
| Name | Type | Use |
|---|
| value | Expression | Required |
ability "macro"
| Name | Type | Use |
|---|
| params | ParamList | Required |
| returns | Type | Required |
| value | Expression | Required |
ability "component"
| Name | Type | Use |
|---|
| fields | FieldList | Optional |
ability "spawn"
| Name | Type | Use |
|---|
| components | ComponentValues | Required |
| entity | VarRef Int | Optional |
ability "despawn"
| Name | Type | Use |
|---|
| entity | Expression Int | Required |
ability "query"
| Name | Type | Use |
|---|
| with | ComponentList | Required |
| without | ComponentList | Optional |
| only | Expression Int | Optional |
| entity | VarRef Int | Optional |
| bind | BindList | Optional |
| body | AbilityList | Required |
ability "despawn_all"
No attributes.
ability "empty"
| Name | Type | Use |
|---|
| list | VarRef | Required · list = true |
ability "remove"
| Name | Type | Use |
|---|
| list | VarRef | Required · list = true |
| index | Expression Int | Required |
ability "attach"
| Name | Type | Use |
|---|
| entity | Expression Int | Required |
| components | ComponentValues | Required |
ability "detach"
| Name | Type | Use |
|---|
| entity | Expression Int | Required |
| components | ComponentList | Required |
ability "value"
| Name | Type | Use |
|---|
| description | String | Optional |
| type | Type | Required |
| initial | Expression | Optional |
| size | Expression | Optional |
| of | Type | Optional |
| to | Type | Optional |
data "value"
| Name | Type | Use |
|---|
| of | VarRef | Required |
| current | Matches of | Return value |
ability "save_text"
| Name | Type | Use |
|---|
| path | Expression String | Required |
| backup | Expression String | Optional |
| text | String | Required |
| status | VarRef Int | Required |
ability "load_text"
| Name | Type | Use |
|---|
| path | Expression String | Required |
| target | VarRef String | Required · buffer = true |
| status | VarRef Int | Required |