1313``` rust
1414import " @weave" ;
1515
16- #[type ]
17- #[extends(" Job" )]
18- First : {
19- #[run]
20- fn first () {
21- self . async_handle (async {
22- sleep (10ms );
23- const diff = Time . diff (self . get (" start" ));
24- self . set (" first" , diff );
25- });
26- }
27- }
28-
29- #[type ]
30- #[extends(" Job" )]
31- Second : {
32- #[run(0)]
33- fn second_0 () {
34- const diff = Time . diff (self . get (" start" ));
35- self . set (" second_0" , diff );
36- sleep (2ms );
37- }
38-
39- #[run(1)]
40- fn second_1 () {
41- const diff = Time . diff (self . get (" start" ));
42- self . set (" second_1" , diff );
43- }
44- }
45-
4616Weave workflow : {
17+ str out : ""
18+
4719 jobs : [
48- new First {},
49- new Second {},
20+ () => {
21+ let out = & self . out;
22+ out . push (" first" );
23+ },
24+ {
25+ #[run]
26+ fn fourth () {
27+ self . async_handle (async {
28+ sleep (5ms );
29+ let out = & self . weave (). out;
30+ out . push (" \ n fourth" );
31+ });
32+ }
33+ },
34+ {
35+ #[run(0)]
36+ fn second () {
37+ let out = & self . weave (). out;
38+ out . push (" \ n second" );
39+ }
40+
41+ #[run(1)]
42+ fn third () {
43+ let out = & self . weave (). out;
44+ out . push (" \ n third" );
45+ }
46+ },
5047 ]
48+
49+ finalize : () => {
50+ let out = & self . out;
51+ out . push (" \ n final" );
52+ }
5153}
5254
5355#[main]
5456fn run_workflow () {
55- self . workflow. set (" start" , Time . now ());
5657 self . workflow. run ();
57-
58- assert (self . workflow. delete (" start" ));
59- pln (stringify ('toml' , self . workflow. background));
58+ pln (self . workflow. out);
6059}
6160```
6261``` bash
63- stof test examples/simple
64- first = 10.0
65- second_0 = 0.0
66- second_1 = 2.0
62+ stof run example.stof
63+ first
64+ second
65+ third
66+ fourth
67+ final
6768```
6869
6970## Differentiators
70- - Single File Simplicity
71+ - Simplicity
7172- Built-in Validation & Healing
7273- No Glue Code
7374- Composability
@@ -76,6 +77,19 @@ second_1 = 2.0
7677## License
7778Apache 2.0. See LICENSE for details.
7879
80+ ## Package Stof CLI Command
81+ Run this Stof CLI command to create a pkg file for use.
82+ ```
83+ stof pkg . dist/weave.pkg
84+ ```
85+
86+ ## Install (unpackage) StofWeave
87+ Run this Stof CLI command to unpack the weave.pkg file into you "stof" folder.
88+ After execution, StofWeave will be available as ` import '@weave'; ` in your Stof code.
89+ ```
90+ stof unpkg dist/weave.pkg
91+ ```
92+
7993## Feedback & Community
8094- Open issues or discussions on [ GitHub] ( https://github.com/dev-formata-io/stof )
8195- Chat with us on [ Discord] ( https://discord.gg/Up5kxdeXZt )
0 commit comments