pub trait Prism<S, A> {
// Required methods
fn preview(&self, whole: &S) -> Option<A>;
fn set_if(&self, whole: &mut S, part: A) -> bool;
}Expand description
A prism for optional focusing (lens that may fail to view).
Unlike a lens, a prism’s preview returns Option<A> — the target
may not exist. Useful for enum variants and optional fields.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".