Expand description
Dispatch for ApplyFirst::apply_first and
RefApplyFirst::ref_apply_first.
Provides the ApplyFirstDispatch trait and a unified
explicit::apply_first free function that routes to the appropriate trait
method based on whether the containers are owned or borrowed.
§Examples
use fp_library::{
brands::*,
functions::explicit::*,
};
// Owned: dispatches to ApplyFirst::apply_first
let y = apply_first::<OptionBrand, _, _, _, _>(Some(5), Some(10));
assert_eq!(y, Some(5));
// By-ref: dispatches to RefApplyFirst::ref_apply_first
let a = Some(5);
let b = Some(10);
let y = apply_first::<OptionBrand, _, _, _, _>(&a, &b);
assert_eq!(y, Some(5));Modules§
- explicit
- Explicit dispatch functions requiring a Brand turbofish.
Traits§
- Apply
First Dispatch - Trait that routes an apply_first operation to the appropriate type class method.
Functions§
- apply_
first - Sequences two applicative actions, keeping the result of the first, inferring the brand from the container type.