[][src]Struct revent::Channel

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

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]

Sort the nodes in this channel.

impl<T: Ord + ?Sized> Channel<T>[src]

pub fn sort(&mut self)[src]

Sort the channel.

Trait Implementations

impl<T: ?Sized> Default for Channel<T>[src]

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]

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

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.