Skip to main content

Module apply_second

Module apply_second 

Source
Expand description

Dispatch for ApplySecond::apply_second and RefApplySecond::ref_apply_second.

Provides the ApplySecondDispatch trait and a unified explicit::apply_second 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 ApplySecond::apply_second
let y = apply_second::<OptionBrand, _, _, _, _>(Some(5), Some(10));
assert_eq!(y, Some(10));

// By-ref: dispatches to RefApplySecond::ref_apply_second
let a = Some(5);
let b = Some(10);
let y = apply_second::<OptionBrand, _, _, _, _>(&a, &b);
assert_eq!(y, Some(10));

Modules§

explicit
Explicit dispatch functions requiring a Brand turbofish.

Traits§

ApplySecondDispatch
Trait that routes an apply_second operation to the appropriate type class method.

Functions§

apply_second
Sequences two applicative actions, keeping the result of the second, inferring the brand from the container type.