Ability

Struct Ability 

Source
pub struct Ability<'f, I, S, O>(/* private fields */)
where
    S: Clone,
    O: Clone;
Expand description

An Ability is a function I -> Fx<S, O>.

Implementations§

Source§

impl<'f, I, S, O> Ability<'f, I, S, O>
where O: Clone, S: Clone + 'f, I: Clone + 'f,

Source

pub fn request(i: I) -> Fx<'f, (Self, S), O>
where I: Clone,

Source

pub fn handler<B, V>(self) -> Handler<'f, (Self, B), B, V, V>
where B: Clone, V: Clone,

Source

pub fn imap<Y, F>(self, imap: F) -> Ability<'f, Y, S, O>
where Y: Clone + 'f, F: FnOnce(Y) -> I + Clone + 'f,

Source

pub fn hmap<T, U, H>(self, h: H) -> Ability<'f, I, T, U>
where T: Clone + 'f, U: Clone + 'f, H: FnOnce(Fx<'f, S, O>) -> Fx<'f, T, U> + Clone + 'f,

Source§

impl<'f, I, S, O> Ability<'f, I, (Vec<O>, S), O>
where O: Clone, S: Clone + 'f, I: Clone + 'f,

Source

pub fn fold_to_vec<V>( self, ) -> Handler<'f, (Ability<'f, I, (Vec<O>, S), O>, (Vec<O>, S)), S, V, (Vec<O>, V)>
where V: Clone,

Source§

impl<'f, I, S, O> Ability<'f, I, (Option<O>, S), O>
where O: Clone, S: Clone + 'f, I: Clone + 'f,

Source

pub fn fold_to_option<V>( self, ) -> Handler<'f, (Ability<'f, I, (Option<O>, S), O>, (Option<O>, S)), S, V, (Option<O>, V)>
where V: Clone,

Source

pub fn fold_to_some<V>( self, ) -> Handler<'f, (Self, (Option<O>, S)), S, V, (O, V)>
where V: Clone,

Source§

impl<'f, I, S, O, Acc> Ability<'f, I, (Acc, S), O>
where O: Clone, S: Clone + 'f, I: Clone + 'f, Acc: Clone + 'f,

Source

pub fn fold<V, F>( self, acc: Acc, of: F, ) -> Handler<'f, (Ability<'f, I, (Acc, S), O>, (Acc, S)), S, V, (Acc, V)>
where V: Clone + 'f, F: FnOnce(Acc, O) -> Fx<'f, S, Acc> + Clone + 'f,

Source§

impl<'f, I, S, O> Ability<'f, I, S, O>
where S: Clone, O: Clone, I: Clone,

Source

pub fn new<F>(f: F) -> Self
where F: FnOnce(I) -> Fx<'f, S, O> + Clone + 'f,

Source

pub fn apply(self, i: I) -> Fx<'f, S, O>

Source

pub fn clone_boxed(&self) -> Box<dyn FnOnce(I) -> Fx<'f, S, O> + 'f>

Trait Implementations§

Source§

impl<'f, I: Clone, S, O> Clone for Ability<'f, I, S, O>
where S: Clone + Clone, O: Clone + Clone,

Source§

fn clone(&self) -> Ability<'f, I, S, O>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'f, I: Clone + 'f, S: Clone + 'f, O: Clone + 'f> From<Ability<'f, I, S, O>> for Box<dyn AbilityFn<'f, I, S, O> + 'f>

Source§

fn from(value: Ability<'f, I, S, O>) -> Self

Converts to this type from the input type.
Source§

impl<'f, I: Clone + 'f, S: Clone + 'f, O: Clone + 'f, F> From<F> for Ability<'f, I, S, O>
where F: FnOnce(I) -> Fx<'f, S, O> + Clone + 'f,

Source§

fn from(value: F) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'f, I, S, O> Freeze for Ability<'f, I, S, O>

§

impl<'f, I, S, O> !RefUnwindSafe for Ability<'f, I, S, O>

§

impl<'f, I, S, O> !Send for Ability<'f, I, S, O>

§

impl<'f, I, S, O> !Sync for Ability<'f, I, S, O>

§

impl<'f, I, S, O> Unpin for Ability<'f, I, S, O>

§

impl<'f, I, S, O> !UnwindSafe for Ability<'f, I, S, O>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.