pub struct SignalRoute {
pub kind: SignalKind,
pub predicate: Option<fn(&Signal) -> bool>,
pub action: Action,
pub priority: i32,
}Expand description
A route mapping a signal kind (with optional predicate) to an action.
Fields§
§kind: SignalKindSignal kind this route handles.
predicate: Option<fn(&Signal) -> bool>Optional predicate for additional filtering.
Uses a function pointer so SignalRoute remains Clone + Send + Sync.
action: ActionAction to take when route matches.
priority: i32Priority: higher value wins when multiple routes match.
Implementations§
Source§impl SignalRoute
impl SignalRoute
Sourcepub fn new(kind: SignalKind, action: Action, priority: i32) -> Self
pub fn new(kind: SignalKind, action: Action, priority: i32) -> Self
Create a new signal route without a predicate.
Sourcepub fn with_predicate(
kind: SignalKind,
predicate: fn(&Signal) -> bool,
action: Action,
priority: i32,
) -> Self
pub fn with_predicate( kind: SignalKind, predicate: fn(&Signal) -> bool, action: Action, priority: i32, ) -> Self
Create a route with an additional predicate.
Trait Implementations§
Source§impl Clone for SignalRoute
impl Clone for SignalRoute
Source§fn clone(&self) -> SignalRoute
fn clone(&self) -> SignalRoute
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SignalRoute
impl RefUnwindSafe for SignalRoute
impl Send for SignalRoute
impl Sync for SignalRoute
impl Unpin for SignalRoute
impl UnsafeUnpin for SignalRoute
impl UnwindSafe for SignalRoute
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