1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/// The base trait for all optics in this library.
///
/// An `Optic` is a general abstraction representing a way to access and update a value (`A`)
/// inside a larger data structure (`S`). The optic attempts to extract the focus value via
/// `try_get` and can replace it via `set`.
///
/// This trait serves as the common foundation for more specialized optic types:
///
/// - [`crate::Lens`] — always succeeds in retrieving a focus value in product types (e.g., struct fields)
/// - [`crate::Prism`] — may fail if the focus is absent, typically for sum types (e.g., enum variants)
/// - [`crate::Iso`] — a reversible bijective transformation that always succeeds
/// - [`crate::FallibleIso`] — a reversible transformation where the mapping can fail
///
/// # See Also
///
/// - [`crate::Prism`] — optional focus in sum types, may fail to extract focus
/// - [`crate::Lens`] — always-present focus in product types
/// - [`crate::FallibleIso`] — reversible transformations with fallible forward mapping
/// - [`crate::Iso`] — reversible one-to-one transformations