pub trait WithOptional: DefinedAt {
type Value: ?Sized;
// Required method
fn try_with<U>(
&self,
fun: impl FnOnce(Option<&Self::Value>) -> U,
) -> Option<U>;
// Provided method
fn with<U>(&self, fun: impl FnOnce(Option<&Self::Value>) -> U) -> U { ... }
}Expand description
An alternative With trait that works with Option<Withable> types.
Required Associated Types§
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".