Skip to main content

BaseFunction

Trait BaseFunction 

Source
pub trait BaseFunction<A, B>: Send + Sync {
    // Required method
    fn apply(&self, a: A) -> Result<B, Error>;
}
Expand description

A function which takes objects of type A and returns objects of type B.

§Translation notes

Any closure Fn(A) -> Result<B, Error> + Send + Sync implements it.

Required Methods§

Source

fn apply(&self, a: A) -> Result<B, Error>

Applies this function to a.

§Arguments
  • a - the value to transform
§Returns

The transformed value.

§Errors

Any error the function returns; it fails the future then_apply returned, as a throwing Java apply does.

Implementors§

Source§

impl<A, B, F> BaseFunction<A, B> for F
where F: Fn(A) -> Result<B, Error> + Send + Sync,