-
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.
Merge pull request #5 from farm-ng/devel
feat: zip & nudge actor, proc-macro improvements
- Loading branch information
Showing
39 changed files
with
1,880 additions
and
713 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,34 @@ | ||
use hollywood::actors::printer::PrinterProp; | ||
use hollywood::actors::{Nudge, Printer}; | ||
use hollywood::compute::Context; | ||
use hollywood::core::*; | ||
|
||
pub async fn run_tick_print_example() { | ||
let pipeline = Context::configure(&mut |context| { | ||
let mut nudge = Nudge::<String>::new(context, "nudge".to_owned()); | ||
let mut nudge_printer = Printer::<String>::from_prop_and_state( | ||
context, | ||
PrinterProp { | ||
topic: "nudge: ".to_string(), | ||
}, | ||
NullState::default(), | ||
); | ||
nudge | ||
.outbound | ||
.nudge | ||
.connect(context, &mut nudge_printer.inbound.printable); | ||
}); | ||
|
||
pipeline.print_flow_graph(); | ||
pipeline.run().await; | ||
} | ||
|
||
fn main() { | ||
tokio::runtime::Builder::new_multi_thread() | ||
.enable_all() | ||
.build() | ||
.unwrap() | ||
.block_on(async { | ||
run_tick_print_example().await; | ||
}) | ||
} |
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,55 @@ | ||
use hollywood::actors::printer::PrinterProp; | ||
use hollywood::actors::zip::{Tuple2, ZipPair}; | ||
use hollywood::actors::{periodic, Printer, Zip2}; | ||
use hollywood::compute::Context; | ||
use hollywood::core::*; | ||
|
||
pub async fn run_tick_print_example() { | ||
let pipeline = Context::configure(&mut |context| { | ||
let mut periodic = periodic::Periodic::new_with_period(context, 1.0); | ||
|
||
let mut zip = | ||
Zip2::<u64, String, String>::new_default_init_state(context, NullProp::default()); | ||
let mut printer = Printer::<Tuple2<u64, String, String>>::from_prop_and_state( | ||
context, | ||
PrinterProp { | ||
topic: "zipped".to_string(), | ||
}, | ||
NullState::default(), | ||
); | ||
|
||
periodic.outbound.time_stamp.connect_with_adapter( | ||
context, | ||
|t| ZipPair { | ||
key: t as u64, | ||
value: "hello".to_string(), | ||
}, | ||
&mut zip.inbound.item0, | ||
); | ||
periodic.outbound.time_stamp.connect_with_adapter( | ||
context, | ||
|t| ZipPair { | ||
key: 2 * t as u64, | ||
value: "world".to_string(), | ||
}, | ||
&mut zip.inbound.item1, | ||
); | ||
|
||
zip.outbound | ||
.zipped | ||
.connect(context, &mut printer.inbound.printable); | ||
}); | ||
|
||
pipeline.print_flow_graph(); | ||
pipeline.run().await; | ||
} | ||
|
||
fn main() { | ||
tokio::runtime::Builder::new_multi_thread() | ||
.enable_all() | ||
.build() | ||
.unwrap() | ||
.block_on(async { | ||
run_tick_print_example().await; | ||
}) | ||
} |
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 @@ | ||
pub mod zip; |
Oops, something went wrong.