Skip to main content

Registry

Struct Registry 

Source
pub(crate) struct Registry<S> {
    storage: S,
}
Expand description

Manages and distributes event notifications to any registered listeners.

Generic over the underlying storage to allow for domain specific optimizations (e.g. eventIds may or may not be contiguous).

Fields§

§storage: S

Implementations§

Source§

impl<S> Registry<S>

Source

fn new(storage: S) -> Self

Source§

impl<S: Storage> Registry<S>

Source

fn register_listener(&self, event_id: usize) -> Receiver<()>

Registers a new listener for event_id.

Source

fn record_event(&self, event_id: usize)

Marks event_id as having been delivered, without broadcasting it to any listeners.

Source

fn broadcast(&self) -> bool

Broadcasts all previously recorded events to their respective listeners.

Returns true if an event was delivered to at least one listener.

Trait Implementations§

Source§

impl<S: Debug> Debug for Registry<S>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> Freeze for Registry<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for Registry<S>
where S: RefUnwindSafe,

§

impl<S> Send for Registry<S>
where S: Send,

§

impl<S> Sync for Registry<S>
where S: Sync,

§

impl<S> Unpin for Registry<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for Registry<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for Registry<S>
where S: 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> 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, 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.