[][src]Struct revent::Single

pub struct Single<T: ?Sized> { /* fields omitted */ }

Single slot containing T.

A single is a container for a single Node. It ensures that a single node always exists, panicking if not present on access. In addition, no more than a single node may subscribe to this container at a time.

Methods

impl<T: ?Sized> Single<T>[src]

pub fn new(name: &'static str, manager: &Manager) -> Self[src]

Create a new single object.

The manager is used to organize multiple single/slot objects and to ensure that there are no recursive (double mutable borrow) signal chains.

name is used for error reporting and graph generation in Manager.

pub fn emit<F, R>(&mut self, caller: F) -> R where
    F: FnMut(&mut T) -> R, 
[src]

Emit a signal on this signal single.

Panics if no node is subscribed to this single.

pub fn register(&mut self, item: Rc<RefCell<T>>)[src]

Add or remove a node object to this single.

The action taken depends on whether Anchor::subscribe or Anchor::unsubscribe was called.

Panics

Panics if called from Anchor::unsubscribe while not being registered.

Panics from a Anchor::subscribe context if an object is already registered with this Single.

Trait Implementations

impl<T: ?Sized> Clone for Single<T>[src]

fn clone(&self) -> Self[src]

Cloning is only valid from within an Anchor::subscribe context.

impl<T: ?Sized> Debug for Single<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Single<T>

impl<T> !Send for Single<T>

impl<T> !Sync for Single<T>

impl<T: ?Sized> Unpin for Single<T>

impl<T> !UnwindSafe for Single<T>

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> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[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.