Skip to main content

Module ref_functor

Module ref_functor 

Source
Expand description

Types that can be mapped over by receiving or returning references to their contents.

§Examples

use fp_library::{brands::*, functions::*, types::*};

let memo = Lazy::<_, RcLazyConfig>::new(|| 10);
let mapped = ref_map::<LazyBrand<RcLazyConfig>, _, _, _>(
    |x: &i32| *x * 2,
    memo
);
assert_eq!(*mapped.evaluate(), 20);

Traits§

RefFunctor
A type class for types that can be mapped over, returning references.

Functions§

ref_map
Maps a function over the values in the functor context, where the function takes a reference.