-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: QIUZHILEI <[email protected]>
- Loading branch information
Showing
3 changed files
with
157 additions
and
61 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//! Construct two different actions. | ||
//! - Create a closure directly | ||
//! - Implementing Complex, the type can have some additional information. | ||
use dagrs::{Complex, DefaultTask, Output}; | ||
|
||
struct Act(usize); | ||
|
||
impl Complex for Act { | ||
fn run(&self, _input: dagrs::Input, _env: std::sync::Arc<dagrs::EnvVar>) -> Output { | ||
Output::new(self.0 + 10) | ||
} | ||
} | ||
fn main() { | ||
let simple = |_input, _env| Output::new("simple"); | ||
let _simple_task = DefaultTask::with_closure("simple task", simple); | ||
|
||
let complex = Act(20); | ||
let _complex_task = DefaultTask::with_action("complex action", complex); | ||
} |
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