Struct rapier2d::data::pubsub::PubSub[][src]

pub struct PubSub<T> { /* fields omitted */ }

A pub-sub queue.

Implementations

impl<T> PubSub<T>[src]

pub fn new() -> Self[src]

Create a new empty pub-sub queue.

pub fn publish(&mut self, message: T)[src]

Publish a new message.

#[must_use]pub fn subscribe(&mut self) -> Subscription<T>[src]

Subscribe to the queue.

A subscription cannot be cancelled.

pub fn read_ith(&self, sub: &Subscription<T>, i: usize) -> Option<&T>[src]

Read the i-th message not yet read by the given subsciber.

pub fn read(&self, sub: &Subscription<T>) -> impl Iterator<Item = &T>[src]

Get the messages not yet read by the given subscriber.

pub fn ack(&mut self, sub: &Subscription<T>)[src]

Makes the given subscribe acknowledge all the messages in the queue.

A subscriber cannot read acknowledged messages any more.

Trait Implementations

impl<T: Clone> Clone for PubSub<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for PubSub<T> where
    T: RefUnwindSafe

impl<T> Send for PubSub<T> where
    T: Send

impl<T> Sync for PubSub<T> where
    T: Sync

impl<T> Unpin for PubSub<T> where
    T: Unpin

impl<T> UnwindSafe for PubSub<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Any + Send + Sync
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.