Expand description
Dispatch for Alt::alt and
RefAlt::ref_alt.
Provides the AltDispatch trait and a unified explicit::alt free
function that routes to the appropriate trait method based on whether the
container is owned or borrowed.
§Examples
use fp_library::{
brands::*,
functions::explicit::*,
};
// Owned: dispatches to Alt::alt
let y = alt::<OptionBrand, _, _, _>(None, Some(5));
assert_eq!(y, Some(5));
// By-ref: dispatches to RefAlt::ref_alt
let y = alt::<OptionBrand, _, _, _>(&None, &Some(5));
assert_eq!(y, Some(5));Modules§
- explicit
- Explicit dispatch functions requiring a Brand turbofish.
Traits§
- AltDispatch
- Trait that routes an alt operation to the appropriate type class method.
Functions§
- alt
- Combines two values in a context, inferring the brand from the container type.