pub trait Setter<S, A>: HasSetter<S, A> { }Expand description
A Setter is an optic that can change its focused value, providing
only a write operation
It provides:
setto set the focused value inside a larger type
This is useful when providing a way to save a particular part of a larger type without giving any access to its contents.
Type Arguments
S: The data type the optic operates onA: The data type the optic focuses on
§Note
This is a marker trait that is blanket implemented for all structs that satisfy the requirements.
§See Also
- [
Prism] — an optic that focuses on a potentially missing value in a product type (ex. optional struct field) or a sum type vairant - [
Lens] — an optic that focuses on an always-present value in a product type (e.g., a required struct field) - [
FallibleIso] — a variant ofIsowhere the mapping might fail, returning an error - [
Iso] — an isomorphism optic representing a reversible bijective conversion between two types