PartialGetter

Trait PartialGetter 

Source
pub trait PartialGetter<S, A>: HasGetter<S, A> { }
Expand description

A PartialGetter is an optic that focuses on a potentially missing value, providing only a read operations

It provides:

  • try_get to optionally extract a focus value from a larger type

This is useful for working with enum variants, Option values, or other sum types where a focus value might be absent.

Type Arguments

  • S: The data type the optic operates on
  • A: 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 of Iso where the mapping might fail, returning an error
  • [Iso] — an isomorphism optic representing a reversible bijective conversion between two types

Implementors§

Source§

impl<S, A, PG: HasGetter<S, A>> PartialGetter<S, A> for PG