Module lens_rs::traits::traversal[][src]

Traversal

A trait representing the optics allows you to traverse over a structure and change out its contents. A TraversalXX can access the multiple substructures.

Example

use lens_rs::*;
let mut x = (1, vec![Some((2, 3)), None]);
x.traverse_mut(optics!(_1._mapped._Some._0))
    .into_iter()
    .for_each(|i| *i += 1);
assert_eq!(x.traverse(optics!(_1._mapped.Some._0)), vec![3]);

Traits

Traversal

the movable version of Traversal

TraversalMut

the mutable version of Traversal

TraversalRef

the immutable version of Traversal