[−][src]Struct revent::Slot
Container for a single optional Node.
Useful for providing a container that may be empty. If the item is always supposed to exist then using Node directly is more useful.
use revent::{Node, Slot}; let mut slot = Slot::new(); slot.insert(Node::new(123)); let result: i32 = slot.emit(|x| { println!("{}", x); *x + 1 }); println!("{}", result);
Implementations
impl<T: ?Sized> Slot<T>
[src]
pub fn new() -> Self
[src]
Create a new slot.
pub fn new_with_trace(trace: impl Fn(usize) + 'static) -> Self
[src]
Create a new channel with a trace object.
pub fn insert(&mut self, item: Node<T>)
[src]
pub fn remove(&mut self) -> Node<T>
[src]
pub fn emit<R>(&self, handler: impl FnOnce(&mut T) -> R) -> R
[src]
Trait Implementations
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Suspend for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,