diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-10-06 17:21:49 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-06 17:21:49 +0800 |
| commit | c1d862d6df58173c24604e4dda33db8ce3be3ad7 (patch) | |
| tree | 171ecf07053748ce7493efaeff5eefbc8645b2cb /examples/src | |
| parent | 66a32a8584cf34a881ec45f47d379fb3b1637033 (diff) | |
| parent | e12f167de8e16baa78c86b09eab75201281d3f95 (diff) | |
Merge pull request #19 from JustEnoughVCS/jvcs_dev
Jvcs dev
Diffstat (limited to 'examples/src')
| -rw-r--r-- | examples/src/bin/example_action_system.rs | 18 | ||||
| -rw-r--r-- | examples/src/lib.rs | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/examples/src/bin/example_action_system.rs b/examples/src/bin/example_action_system.rs new file mode 100644 index 0000000..a659eb3 --- /dev/null +++ b/examples/src/bin/example_action_system.rs @@ -0,0 +1,18 @@ +use action_system::{action::ActionContext, action_gen, action_pool::ActionPool}; +use tcp_connection::error::TcpTargetError; + +#[tokio::main] +async fn main() { + let mut pool = ActionPool::new(); + PrintNameAction::register_to_pool(&mut pool); + + PrintNameAction::process_at_pool(&pool, ActionContext::local(), "World".to_string()) + .await + .unwrap(); +} + +#[action_gen] +async fn print_name_action(_ctx: ActionContext, name: String) -> Result<(), TcpTargetError> { + println!("Hello, {}!", name); + Ok(()) +} diff --git a/examples/src/lib.rs b/examples/src/lib.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/examples/src/lib.rs @@ -0,0 +1 @@ + |
