forked from hydro-project/hydroflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b92dfc7
commit 2dd8ee1
Showing
23 changed files
with
155 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use hydroflow::hydroflow_syntax; | ||
|
||
pub fn main() { | ||
let mut flow = hydroflow_syntax! { | ||
source_iter(vec!["Hello", "world"]) | ||
-> map(|x| x.to_uppercase()) -> for_each(|x| println!("{}", x)); | ||
}; | ||
flow.run_available(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use hydroflow::hydroflow_syntax; | ||
|
||
pub fn main() { | ||
let mut flow = hydroflow_syntax! { | ||
source_iter(vec!["Hello", "world"]) -> upper_print; | ||
upper_print = map(|x| x.to_uppercase()) -> for_each(|x| println!("{}", x)); | ||
}; | ||
flow.run_available(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use hydroflow::hydroflow_syntax; | ||
|
||
pub fn main() { | ||
let mut flow = hydroflow_syntax! { | ||
my_tee = source_iter(vec!["Hello", "world"]) -> tee(); | ||
my_tee -> map(|x| x.to_uppercase()) -> [low_road]my_union; | ||
my_tee -> map(|x| x.to_lowercase()) -> [high_road]my_union; | ||
my_union = union() -> for_each(|x| println!("{}", x)); | ||
}; | ||
println!( | ||
"{}", | ||
flow.meta_graph() | ||
.expect("No graph found, maybe failed to parse.") | ||
.to_mermaid(&Default::default()) | ||
); | ||
flow.run_available(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use hydroflow::hydroflow_syntax; | ||
|
||
pub fn main() { | ||
let mut flow = hydroflow_syntax! { | ||
source_iter([()]) | ||
-> for_each(|()| println!("Current tick: {}, stratum: {}", context.current_tick(), context.current_stratum())); | ||
}; | ||
flow.run_available(); | ||
} |
7 changes: 7 additions & 0 deletions
7
hydroflow/tests/snapshots/surface_examples__example_surface_flows_1_basic.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: hydroflow/tests/surface_examples.rs | ||
expression: output | ||
--- | ||
HELLO | ||
WORLD | ||
|
7 changes: 7 additions & 0 deletions
7
hydroflow/tests/snapshots/surface_examples__example_surface_flows_2_varname.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: hydroflow/tests/surface_examples.rs | ||
expression: output | ||
--- | ||
HELLO | ||
WORLD | ||
|
50 changes: 50 additions & 0 deletions
50
hydroflow/tests/snapshots/surface_examples__example_surface_flows_3_ports.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
source: hydroflow/tests/surface_examples.rs | ||
expression: output | ||
--- | ||
%%{init:{'theme':'base','themeVariables':{'clusterBkg':'#ddd','clusterBorder':'#888'}}}%% | ||
flowchart TD | ||
classDef pullClass fill:#8af,stroke:#000,text-align:left,white-space:pre | ||
classDef pushClass fill:#ff8,stroke:#000,text-align:left,white-space:pre | ||
classDef otherClass fill:#fdc,stroke:#000,text-align:left,white-space:pre | ||
linkStyle default stroke:#aaa | ||
1v1[\"(1v1) <code>source_iter(vec!["Hello", "world"])</code>"/]:::pullClass | ||
2v1[/"(2v1) <code>tee()</code>"\]:::pushClass | ||
3v1[\"(3v1) <code>map(|x| x.to_uppercase())</code>"/]:::pullClass | ||
4v1[\"(4v1) <code>map(|x| x.to_lowercase())</code>"/]:::pullClass | ||
5v1[\"(5v1) <code>union()</code>"/]:::pullClass | ||
6v1[/"(6v1) <code>for_each(|x| println!("{}", x))</code>"\]:::pushClass | ||
7v1["(7v1) <code>handoff</code>"]:::otherClass | ||
8v1["(8v1) <code>handoff</code>"]:::otherClass | ||
1v1-->2v1 | ||
3v1-->|low_road|5v1 | ||
2v1-->7v1 | ||
4v1-->|high_road|5v1 | ||
2v1-->8v1 | ||
5v1-->6v1 | ||
7v1-->3v1 | ||
8v1-->4v1 | ||
subgraph sg_1v1 ["sg_1v1 stratum 0"] | ||
1v1 | ||
2v1 | ||
subgraph sg_1v1_var_my_tee ["var <tt>my_tee</tt>"] | ||
1v1 | ||
2v1 | ||
end | ||
end | ||
subgraph sg_2v1 ["sg_2v1 stratum 0"] | ||
3v1 | ||
4v1 | ||
5v1 | ||
6v1 | ||
subgraph sg_2v1_var_my_union ["var <tt>my_union</tt>"] | ||
5v1 | ||
6v1 | ||
end | ||
end | ||
|
||
hello | ||
world | ||
HELLO | ||
WORLD | ||
|
6 changes: 6 additions & 0 deletions
6
hydroflow/tests/snapshots/surface_examples__example_surface_flows_4_context.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
source: hydroflow/tests/surface_examples.rs | ||
expression: output | ||
--- | ||
Current tick: [0], stratum: 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters