pub trait RefApplicative:
RefPointed
+ RefSemiapplicative
+ RefApplyFirst
+ RefApplySecond { }Expand description
A type class for by-ref applicative functors.
Combines RefPointed (injecting values from references) with
RefSemiapplicative (applying wrapped by-ref functions).
This is the by-ref counterpart of Applicative. Automatically
implemented for any type implementing both supertraits.
A lawful RefApplicative must satisfy the applicative laws
(identity, composition, homomorphism, interchange) expressed
in terms of ref_pure and ref_apply. These mirror the
standard Applicative laws but with by-ref function wrappers:
- Identity:
ref_apply(ref_pure(&id), v) = v(evaluated values equal). - Homomorphism:
ref_apply(ref_pure(&f), ref_pure(&x)) = ref_pure(&f(&x)). - Interchange:
ref_apply(u, ref_pure(&y)) = ref_apply(ref_pure(&(|f| f(&y))), u).
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.
Implementors§
impl<Brand> RefApplicative for Brand
Blanket implementation of RefApplicative.
§Type Parameters
Brand: The brand type.