pub trait RefLens: Lens {
// Required method
fn get_ref<'a>(&self, source: &'a Self::Source) -> &'a Self::Target;
// Provided methods
fn mutate_with_fn(
&self,
source: &mut Self::Source,
f: &dyn Fn(&Self::Target) -> Self::Target,
) { ... }
fn modify(
&self,
source: Self::Source,
f: &dyn Fn(&Self::Target) -> Self::Target,
) -> Self::Source { ... }
}Expand description
A lens that allows the target to be accessed and mutated by reference.