pub struct ListenOpts {
pub after: Vec<String>,
pub before: Vec<String>,
pub priority: i32,
pub deadline: Option<Duration>,
pub owner: Option<String>,
pub threaded: bool,
}Expand description
How a listener is placed and limited.
Fields§
§after: Vec<String>Listeners this one runs after.
before: Vec<String>Listeners this one runs before.
priority: i32Among listeners after/before leave free, higher runs first;
ties run in registration order.
deadline: Option<Duration>Overrides the point’s deadline.
owner: Option<String>Who registered it (a module, a plugin), for Bus::forget and
introspection.
threaded: boolRuns on a thread of its own, so the emit stops waiting at the deadline. An inline listener (the default) runs on the emitting thread: it cannot be stopped, and only counts as late once it returns.
Implementations§
Source§impl ListenOpts
impl ListenOpts
Sourcepub fn new() -> ListenOpts
pub fn new() -> ListenOpts
No constraint, priority 0, the point’s deadline, inline.
Sourcepub fn after(self, id: impl Into<String>) -> ListenOpts
pub fn after(self, id: impl Into<String>) -> ListenOpts
Runs after the listener id (a missing one is reported and
ignored).
Sourcepub fn before(self, id: impl Into<String>) -> ListenOpts
pub fn before(self, id: impl Into<String>) -> ListenOpts
Runs before the listener id (a missing one is reported and
ignored).
Sourcepub fn last(self) -> ListenOpts
pub fn last(self) -> ListenOpts
Runs after every other listener of its point, whatever they
declare: an invariants check, a listener that reads what all the
others left. One per point: a second one closes a cycle and is
refused (Refused::Cycle). Kept in ListenOpts::after as
LAST.
Sourcepub fn is_last(&self) -> bool
pub fn is_last(&self) -> bool
Whether the listener runs after every other one of its point
(ListenOpts::last).
Sourcepub fn priority(self, priority: i32) -> ListenOpts
pub fn priority(self, priority: i32) -> ListenOpts
Higher runs first among listeners left free by after/before.
Sourcepub fn deadline(self, deadline: Duration) -> ListenOpts
pub fn deadline(self, deadline: Duration) -> ListenOpts
Overrides the point’s deadline.
Sourcepub fn owner(self, owner: impl Into<String>) -> ListenOpts
pub fn owner(self, owner: impl Into<String>) -> ListenOpts
Who registered the listener.
Sourcepub fn threaded(self) -> ListenOpts
pub fn threaded(self) -> ListenOpts
Runs on a thread of its own, so a slow listener cannot hold the emit past its deadline.