-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
[Merged by Bors] - Allow piping run conditions #7547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a61fac2
8379882
6ccd47b
79a7046
6b7cf9c
0020100
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,8 @@ use crate::{ | |
| }; | ||
| use std::{any::TypeId, borrow::Cow}; | ||
|
|
||
| use super::ReadOnlySystem; | ||
|
|
||
| /// A [`System`] created by piping the output of the first system into the input of the second. | ||
| /// | ||
| /// This can be repeated indefinitely, but system pipes cannot branch: the output is consumed by the receiving system. | ||
|
|
@@ -153,6 +155,15 @@ impl<SystemA: System, SystemB: System<In = SystemA::Out>> System for PipeSystem< | |
| } | ||
| } | ||
|
|
||
| /// SAFETY: Both systems are read-only, so piping them together will only read from the world. | ||
| unsafe impl<SystemA: System, SystemB: System<In = SystemA::Out>> ReadOnlySystem | ||
| for PipeSystem<SystemA, SystemB> | ||
| where | ||
| SystemA: ReadOnlySystem, | ||
| SystemB: ReadOnlySystem, | ||
| { | ||
| } | ||
|
|
||
| /// An extension trait providing the [`IntoPipeSystem::pipe`] method to pass input from one system into the next. | ||
| /// | ||
| /// The first system must have return type `T` | ||
|
|
@@ -412,10 +423,16 @@ pub mod adapter { | |
| unimplemented!() | ||
| } | ||
|
|
||
| fn not(In(val): In<bool>) -> bool { | ||
| !val | ||
| } | ||
|
Comment on lines
+426
to
+428
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe move it into There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't want to include the |
||
|
|
||
| assert_is_system(returning::<Result<u32, std::io::Error>>.pipe(unwrap)); | ||
| assert_is_system(returning::<Option<()>>.pipe(ignore)); | ||
| assert_is_system(returning::<&str>.pipe(new(u64::from_str)).pipe(unwrap)); | ||
| assert_is_system(exclusive_in_out::<(), Result<(), std::io::Error>>.pipe(error)); | ||
| assert_is_system(returning::<bool>.pipe(exclusive_in_out::<bool, ()>)); | ||
|
|
||
| returning::<()>.run_if(returning::<bool>.pipe(not)); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.