Heap

Struct Heap 

Source
pub struct Heap<M> { /* private fields */ }
Expand description

Stores an indirected Handler in a Box for later delegation.

Implementations§

Source§

impl<M> Heap<M>

Source

pub fn new(delegate: Box<dyn Handler<M>>) -> Heap<M>

Creates a new Heap with a given Boxed Handler. # Examples

use roopes::prelude::*;
let my_handler =
    handler::Heap::new(Box::new(handler::Lambda::new(|message| {
        println!("{message}");
    })));
my_handler.handle(&"Hello World.".to_string());

Trait Implementations§

Source§

impl<M> From<Box<dyn Handler<M>>> for Heap<M>

Source§

fn from(value: Box<dyn Handler<M>>) -> Self

Converts to this type from the input type.
Source§

impl<M> Handler<M> for Heap<M>

Source§

fn handle(&self, message: &M)

Receives a borrowed value.

Auto Trait Implementations§

§

impl<M> Freeze for Heap<M>

§

impl<M> !RefUnwindSafe for Heap<M>

§

impl<M> !Send for Heap<M>

§

impl<M> !Sync for Heap<M>

§

impl<M> Unpin for Heap<M>

§

impl<M> !UnwindSafe for Heap<M>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<H, M> IntoSubscriber<H, M> for H
where H: Handler<M>,

Source§

fn into_subscriber(self) -> SubscribingHandler<H, M>

Wraps the Handler in a SubscribingHandler, for use as a Subscriber.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.