pub struct Signal {
pub id: String,
pub metadata: HashMap<String, String>,
}Available on crate feature
signals only.Expand description
A signal emitted through the arbiter.
Signals are identified by an arbitrary string and can carry a map of metadata. Callers are free to define their own conventions for ids and fields.
Fields§
§id: StringIdentifier of the signal, for example “request.started” or “metrics.tick”.
metadata: HashMap<String, String>Optional metadata payload carried with the signal.
Implementations§
Source§impl Signal
impl Signal
Sourcepub fn new(id: impl Into<String>) -> Self
pub fn new(id: impl Into<String>) -> Self
Creates a new signal with the given id and empty metadata.
Sourcepub fn with_metadata(
id: impl Into<String>,
metadata: HashMap<String, String>,
) -> Self
pub fn with_metadata( id: impl Into<String>, metadata: HashMap<String, String>, ) -> Self
Creates a new signal with initial metadata.
Sourcepub fn from_payload<P: SignalPayload>(payload: &P) -> Self
pub fn from_payload<P: SignalPayload>(payload: &P) -> Self
Creates a signal from a typed payload implementing SignalPayload.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Signal
impl RefUnwindSafe for Signal
impl Send for Signal
impl Sync for Signal
impl Unpin for Signal
impl UnwindSafe for Signal
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