[][src]Trait pl_lens::Lens

pub trait Lens {
    type Source;
    type Target;
    fn path(&self) -> LensPath;

    fn set(&self, source: Self::Source, target: Self::Target) -> Self::Source { ... }
}

A lens offers a purely functional means to access and/or modify a field that is nested in an immutable data structure.

Associated Types

type Source

The lens source type, i.e., the object containing the field.

type Target

The lens target type, i.e., the field to be accessed or modified.

Loading content...

Required methods

fn path(&self) -> LensPath

Returns a LensPath that describes the target of this lens relative to its source.

Loading content...

Provided methods

fn set(&self, source: Self::Source, target: Self::Target) -> Self::Source

Sets the target of the lens and returns the new state of the source. (This consumes the source.)

Loading content...

Implementations on Foreign Types

impl<L: Lens + ?Sized> Lens for Box<L>[src]

type Source = L::Source

type Target = L::Target

Loading content...

Implementors

impl<LHS, RHS> Lens for ComposedLens<LHS, RHS> where
    LHS: RefLens,
    LHS::Target: 'static,
    RHS: Lens<Source = LHS::Target>, 
[src]

type Source = LHS::Source

type Target = RHS::Target

Loading content...