pub trait HasTotalGetter<S, A> {
// Required method
fn get(&self, source: &S) -> A;
}Expand description
Provides a simplified interface for optics with infallible getter operations.
This trait is automatically implemented for any optic that implements
HasGetter with a [GetterError] type of Infallible.
§Example
use optics::{HasTotalGetter, mapped_getter};
struct Point {
x: u32,
y: u32,
}
let x_getter = mapped_getter(
|p: &Point| p.x,
);
let point = Point { x: 10, y: 20 };
let x_value = x_getter.get(&point); // x_value is 10§See also:
HasGetter: base trait for optics that provides a potentially fallible getter operation.