pub struct Decision<E> {
pub disposition: Disposition,
pub effects: Vec<E>,
}Expand description
Outcome of Processor::decide_data / Processor::decide_system:
a disposition for the input frame plus zero or more effects to emit.
§Four forms
use pipecrab_core::{Decision, Disposition};
// 1. Pass-through: forward the input, emit nothing.
let d: Decision<u32> = Decision::forward();
assert_eq!(d.disposition, Disposition::Forward);
assert!(d.effects.is_empty());
// 2. Transform (drop-on-emit): consume the input, emit a replacement.
let d: Decision<u32> = Decision::drop().emit(42);
assert_eq!(d.disposition, Disposition::Drop);
assert_eq!(d.effects, [42]);
// 3. Observe-and-pass: forward the input *and* emit a derived value.
let d: Decision<u32> = Decision::forward().emit(42);
assert_eq!(d.disposition, Disposition::Forward);
assert_eq!(d.effects, [42]);
// 4. Silent drop: consume the input, emit nothing.
let d: Decision<u32> = Decision::drop();
assert_eq!(d.disposition, Disposition::Drop);
assert!(d.effects.is_empty());Fields§
§disposition: DispositionWhat happens to the input frame.
effects: Vec<E>Effects to perform, in order, after the disposition is acted on.
Implementations§
Trait Implementations§
impl<E: Eq> Eq for Decision<E>
impl<E: PartialEq> StructuralPartialEq for Decision<E>
Auto Trait Implementations§
impl<E> Freeze for Decision<E>
impl<E> RefUnwindSafe for Decision<E>where
E: RefUnwindSafe,
impl<E> Send for Decision<E>where
E: Send,
impl<E> Sync for Decision<E>where
E: Sync,
impl<E> Unpin for Decision<E>where
E: Unpin,
impl<E> UnsafeUnpin for Decision<E>
impl<E> UnwindSafe for Decision<E>where
E: UnwindSafe,
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