Module im::lens
[−]
[src]
A view into a data structure.
A lens describes a view into a data structure, like an index or key lookup, with the ability to modify what it sees. It provides a get operation (get the thing we're a lens for) and a set operation (modify the data structure we're a lens into with the a value for the thing).
Lenses are composable, so that if you have a lens from A to a thing B inside A, and you have a lens from B to another thing C inside B, you can compose them to make a lens from A directly into C.
There are two kinds of lenses defined here: PartialLens
, which is a lens
into something which doesn't necessarily exist (such as a map key), and
Lens
, which must always be able to succeed. All Lens
es are also
PartialLens
es, but the opposite is not true.
Structs
Compose |
Traits
Lens |
A lens from |
PartialLens |
A lens from |
Functions
compose |
Compose a lens from |