[][src]Struct sauron::Callback

pub struct Callback<IN, OUT>(_);

A generic sized representation of a function that can be attached to a Node. The callback will essentially be owned by the element

Methods

impl<IN, OUT> Callback<IN, OUT> where
    IN: 'static,
    OUT: 'static, 
[src]

pub fn emit<T>(&self, value: T) -> OUT where
    T: Into<IN>, 
[src]

This method calls the actual callback.

pub fn reform<F, IN2>(self, func: F) -> Callback<IN2, OUT> where
    F: Fn(IN2) -> IN + 'static, 
[src]

Changes input type of the callback to another. Works like common map method but in an opposite direction.

pub fn map<F, OUT2>(self, func: F) -> Callback<IN, OUT2> where
    F: Fn(OUT) -> OUT2 + 'static, 
[src]

Map the output of this callback to return a different type

Trait Implementations

impl<IN, OUT> Clone for Callback<IN, OUT> where
    IN: Clone,
    OUT: Clone
[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<IN, OUT> Debug for Callback<IN, OUT>[src]

impl<IN, OUT> PartialEq<Callback<IN, OUT>> for Callback<IN, OUT>[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<IN, F, OUT> From<F> for Callback<IN, OUT> where
    F: Fn(IN) -> OUT + 'static, 
[src]

Auto Trait Implementations

impl<IN, OUT> !Send for Callback<IN, OUT>

impl<IN, OUT> !Sync for Callback<IN, OUT>

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> 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.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]