[][src]Struct revent::Slot

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

List of Subscribers to a signal T.

A slot is a list in which one can store subscriber handles.

Methods

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

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

Create a new slot 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>(&mut self, caller: F) where
    F: FnMut(&mut T), 
[src]

Emit a signal on this signal slot.

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

Continue emitting only if the caller returns true. Stops if false.

pub fn sort_by<F>(&mut self, compare: F) where
    F: FnMut(&T, &T) -> Ordering
[src]

Sort the subscribers to this slot.

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

Add or remove a subscriber object to this slot.

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

When adding: pushes the item to the end of the list. See sort_by if a different order is desired. When removing: finds the first matching instance and removes it.

Trait Implementations

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

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

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

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

Auto Trait Implementations

impl<T> !RefUnwindSafe for Slot<T>

impl<T> !Send for Slot<T>

impl<T> !Sync for Slot<T>

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

impl<T> !UnwindSafe for Slot<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.