Skip to main content

ListenOpts

Struct ListenOpts 

Source
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: i32

Among 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: bool

Runs 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. A local listener runs inline on its own thread: it is refused with this set (Refused::Threaded).

Implementations§

Source§

impl ListenOpts

Source

pub fn new() -> ListenOpts

No constraint, priority 0, the point’s deadline, inline.

Source

pub fn after(self, id: impl Into<String>) -> ListenOpts

Runs after the listener id (a missing one is reported and ignored).

Source

pub fn before(self, id: impl Into<String>) -> ListenOpts

Runs before the listener id (a missing one is reported and ignored).

Source

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.

Source

pub fn is_last(&self) -> bool

Whether the listener runs after every other one of its point (ListenOpts::last).

Source

pub fn priority(self, priority: i32) -> ListenOpts

Higher runs first among listeners left free by after/before.

Source

pub fn deadline(self, deadline: Duration) -> ListenOpts

Overrides the point’s deadline.

Source

pub fn owner(self, owner: impl Into<String>) -> ListenOpts

Who registered the listener.

Source

pub fn threaded(self) -> ListenOpts

Runs on a thread of its own, so a slow listener cannot hold the emit past its deadline.

Trait Implementations§

Source§

impl Clone for ListenOpts

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ListenOpts

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ListenOpts

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for ListenOpts

Source§

impl PartialEq for ListenOpts

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ListenOpts

Auto Trait Implementations§

§

impl Forget for ListenOpts

§

impl Freeze for ListenOpts

§

impl Move for ListenOpts

§

impl RefUnwindSafe for ListenOpts

§

impl Send for ListenOpts
where RawVecInner: Send,

§

impl Sync for ListenOpts
where RawVecInner: Sync,

§

impl Unpin for ListenOpts
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for ListenOpts

§

impl UnwindSafe for ListenOpts
where RawVecInner: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.