Chain

Struct Chain 

Source
pub struct Chain<N = Waker> { /* private fields */ }
Expand description

A shared list of intrusively linked objects that can be notified.

Implementations§

Source§

impl<N> Chain<N>

Source

pub fn new() -> Self

Creates a new, empty chain.

Source

pub fn clear(&mut self)

Removes all the queued-up objects without notifying them.

Source

pub fn is_empty(&self) -> bool

Returns true if this chain is empty.

Source

pub fn notify_one(&self) -> NotifyOne<'_, N>
where N: Subscriber,

Constructs a Notifier for the first linked object.

At most one object is notified once the go-method is called and the chain isn’t empty, but the caller may execute additional methods that change which object is notified and what happens in that case.

The notified object (if any) is automatically removed from the chain.

Source

pub fn notify_all(&self) -> NotifyAll<'_, N>
where N: Subscriber,

Constructs a Notifier for all the linked objects.

Potentially all the objects in the chain are notified when the go method is called, but the caller may execute additional methods that change which objects are notified and what happens in that case.

All notified objects are automatically removed from the chain.

Source§

impl Chain<Waker>

Source

pub async fn fifo(&self)

Enters the current process into a FIFO-queue, to be activated later.

The reactivation follows queue-ordering, i.e. first-in first-out.

Source

pub async fn lifo(&self)

Enters the current process into a LIFO-queue, to be activated later.

The reactivation follows stack-ordering, i.e. last-in first-out.

Trait Implementations§

Source§

impl<N: Debug> Debug for Chain<N>

Source§

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

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

impl<N> Default for Chain<N>

Source§

fn default() -> Self

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

impl<N> Drop for Chain<N>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<N: Subscriber> Publisher for Chain<N>

The type of the object this notifier informs.
Source§

unsafe fn subscribe(&self, link: Pin<&Self::Link>)

Unsafely subscribes a link to the notifier. Read more
Source§

unsafe fn unsubscribe(&self, link: Pin<&Self::Link>)

Unsafely unsubscribes a link from the notifier. Read more
Source§

impl<N: Subscriber> Subscriber for Chain<N>

Source§

fn notify(&self)

Notifies all the linked objects, removing them all from the chain.

Auto Trait Implementations§

§

impl<N = Waker> !Freeze for Chain<N>

§

impl<N = Waker> !RefUnwindSafe for Chain<N>

§

impl<N = Waker> !Send for Chain<N>

§

impl<N = Waker> !Sync for Chain<N>

§

impl<N> Unpin for Chain<N>

§

impl<N = Waker> !UnwindSafe for Chain<N>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PubTerm for T
where T: Publisher,

Source§

fn pub_term(&self) -> &Self

Trait method that is selected if the instance in question implements the Publisher-trait.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more