pub trait OptionFilterExt {
type OptionFilterInner;
// Required method
fn filter<F: FnOnce(&Self::OptionFilterInner) -> bool>(self, _: F) -> Self;
}
Expand description
Extension trait for adding a .filter()
method to Option<T>
.
This trait is intended for extending Option<T>
only, and should
not be implemented for other types.
Required Associated Types§
Sourcetype OptionFilterInner
type OptionFilterInner
The inner type of the Option
.
This is given an unwieldy name so that it’s unlikely to conflict with other associated types.
Required Methods§
Sourcefn filter<F: FnOnce(&Self::OptionFilterInner) -> bool>(self, _: F) -> Self
fn filter<F: FnOnce(&Self::OptionFilterInner) -> bool>(self, _: F) -> Self
Filters the element of an Option
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.