[−][src]Struct revent::Channel
Container for multiple Nodes.
use revent::{Channel, Node}; let mut channel = Channel::new(); for number in 0..10 { channel.insert(Node::new(number)); } channel.emit(|x| { println!("{}", x); });
Methods
impl<T: ?Sized> Channel<T>
[src]
pub fn new() -> Self
[src]
Create a new channel.
pub fn insert(&mut self, item: Node<T>)
[src]
Insert a node into this channel.
Appends the node to the end of the channel.
pub fn remove(&mut self, item: &Node<T>)
[src]
Remove a node from this channel if it exists.
Performance
Performs a linear scan and retains only those nodes that do not match.
pub fn emit(&self, handler: impl FnMut(&mut T))
[src]
Apply a function to each item in this channel.
pub fn emit_ref(&self, handler: impl FnMut(&T))
[src]
Apply a function to each item in this channel.
Immutable version of emit.
pub fn sort_by<F>(&mut self, compare: F) where
F: FnMut(&T, &T) -> Ordering,
[src]
F: FnMut(&T, &T) -> Ordering,
Sort the nodes in this channel.
impl<T: Ord + ?Sized> Channel<T>
[src]
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for Channel<T>
impl<T> !Send for Channel<T>
impl<T> !Sync for Channel<T>
impl<T: ?Sized> Unpin for Channel<T>
impl<T> !UnwindSafe for Channel<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]
fn suspend<F: FnOnce() -> R, R>(&mut self, runner: F) -> R
[src]
fn suspend_ref<F: FnOnce() -> R, R>(&self, runner: F) -> R
[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>,