Guestlist problem
Console program40 lines of .st71 lines of generated Rust
Hello, what's your name? "Ada"
On this page
The .st files#
intent.st
structop {
type_app {
exec = {
lang = "Rust"
}
}
}main.st
ability "function" "what_is_your_name" {
returns = String
locals = [{ name = "your_name", type = String, size = 64 }]
body = [ability.read_line.Line]
return = your_name
}
ability "read_line" "Line" {
target = your_name
}
ability "print" "Question" {
message = "Hello, what's your name?"
}
ability "call" "GetName" {
function = ability.function.what_is_your_name
result = ability.value.name
depends_on = [ability.print.Question]
}
ability "print" "Debug" {
message = "\"${data.value.name.current}\""
depends_on = [ability.call.GetName]
}vars.st
ability "value" "name" {
type = String
size = 64
}
data "value" "name" {
of = ability.value.name
}Input, plan and generated Rust#
input.txt · typed input (1 lines)
input.txt · typed input (1 lines)
Adastructop plan
structop plan
# program.app will be created
+ program.app (.structop/build/app)
+ ability.function.what_is_your_name
+ ability.read_line.Line
+ ability.print.Question
+ ability.call.GetName
+ ability.print.Debug
+ ability.value.name
Plan: 1 to add, 0 to change, 0 to destroy.Generated main.rs
To inspect this generated file, select Rust in intent.st, initialize the project and export its source.
Export locally
structop init
structop apply -source -no-runTry it
cd rust-guestlist-problem # a folder holding the .st files above
structop init
structop plan
structop apply < input.txt