Trait Pure

Source
pub trait Pure<A> {
    // Required method
    fn pure(value: A) -> Self;
}
Expand description

Pure lets you construct a value of type F<A> from a single value of A.

For instance:

  • Option::pure(5) returns Some(5).
  • Result::pure(5) returns Ok(5).
  • Vec::pure(5) returns vec![5].

Required Methods§

Source

fn pure(value: A) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<A> Pure<A> for Option<A>

Source§

fn pure(value: A) -> Self

Source§

impl<A> Pure<A> for Vec<A>

Source§

fn pure(value: A) -> Self

Source§

impl<A, E> Pure<A> for Result<A, E>

Source§

fn pure(value: A) -> Self

Implementors§

Source§

impl<'a, A> Pure<A> for Effect<'a, A>
where A: 'a,

Source§

impl<'a, A: 'a, E> Pure<A> for IO<'a, A, E>