Hello yourname
Console program28 lines of .st60 lines of generated Rust
Hello, what's your name? Hello, Ada
On this page
The .st files#
intent.st
structop {
type_app {
exec = {
lang = "Rust"
}
}
}main.st
ability "print" "Question" {
message = "Hello, what's your name?"
}
ability "read_line" "Answer" {
target = ability.value.your_name
depends_on = [ability.print.Question]
}
ability "print" "Greeting" {
message = "Hello, ${data.value.your_name.current}"
depends_on = [ability.read_line.Answer]
}vars.st
ability "value" "your_name" {
type = String
size = 64
}
data "value" "your_name" {
of = ability.value.your_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.print.Question
+ ability.read_line.Answer
+ ability.print.Greeting
+ ability.value.your_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-hello-yourname # a folder holding the .st files above
structop init
structop plan
structop apply < input.txt