[−][src]Trait pl_lens::RefLens
A lens that allows the target to be accessed and mutated by reference.
Required methods
fn get_ref<'a>(&self, source: &'a Self::Source) -> &'a Self::Target
Gets a reference to the target of the lens. (This does not consume the source.)
Provided methods
fn mutate_with_fn<'a>(
&self,
source: &'a mut Self::Source,
f: &dyn Fn(&Self::Target) -> Self::Target
)
&self,
source: &'a mut Self::Source,
f: &dyn Fn(&Self::Target) -> Self::Target
)
Modifies the target of the lens by applying a function to the current value.
fn modify(
&self,
source: Self::Source,
f: &dyn Fn(&Self::Target) -> Self::Target
) -> Self::Source
&self,
source: Self::Source,
f: &dyn Fn(&Self::Target) -> Self::Target
) -> Self::Source
Modifies the target of the lens by applying a function to the current value. This consumes the source.
Implementations on Foreign Types
impl<L: RefLens + ?Sized> RefLens for Box<L>
[src]
fn get_ref<'a>(&self, source: &'a L::Source) -> &'a L::Target
[src]
fn get_mut_ref<'a>(&self, source: &'a mut L::Source) -> &'a mut L::Target
[src]
Implementors
impl<LHS, RHS> RefLens for ComposedLens<LHS, RHS> where
LHS: RefLens,
LHS::Target: 'static,
RHS: RefLens<Source = LHS::Target>,
[src]
LHS: RefLens,
LHS::Target: 'static,
RHS: RefLens<Source = LHS::Target>,