Module lens_rs::traits::prism[][src]

Prism

Traits representing the optics behaves as the first-class pattern. A PrismXX can access the substructure may exist.

use lens_rs::*;
let mut x: (_, Result<_, ()>) = (1, Ok((2, 3)));
*x.preview_mut(optics!(_1.Ok._1))? *= 2;
assert_eq!(x.preview(optics!(_1.Ok._1))?, 6);

Traits

Prism

the movable version of Prism

PrismMut

the mutable version of Prism

PrismRef

the immutable version of Prism