pub struct Case {
pub condition: Arc<dyn Fn(&Value) -> Pin<Box<dyn Future<Output = bool> + Send>> + Send + Sync>,
pub target: String,
pub label: Option<String>,
}Expand description
A switch/case branch: if condition matches, route to target.
Fields§
§condition: Arc<dyn Fn(&Value) -> Pin<Box<dyn Future<Output = bool> + Send>> + Send + Sync>§target: String§label: Option<String>Optional human-readable label used in visualization.
Implementations§
Source§impl Case
impl Case
Sourcepub fn new(
condition: impl Fn(&Value) -> bool + Send + Sync + 'static,
target: impl Into<String>,
) -> Case
pub fn new( condition: impl Fn(&Value) -> bool + Send + Sync + 'static, target: impl Into<String>, ) -> Case
A case routing to target when the synchronous condition holds.
Sourcepub fn new_async<F, Fut>(condition: F, target: impl Into<String>) -> Case
pub fn new_async<F, Fut>(condition: F, target: impl Into<String>) -> Case
A case routing to target when the async condition holds.
Auto Trait Implementations§
impl !RefUnwindSafe for Case
impl !UnwindSafe for Case
impl Freeze for Case
impl Send for Case
impl Sync for Case
impl Unpin for Case
impl UnsafeUnpin for Case
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more