Trait OptionFilterExt

Source
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§

Source

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§

Source

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.

Implementations on Foreign Types§

Source§

impl<T> OptionFilterExt for Option<T>

Source§

type OptionFilterInner = T

Source§

fn filter<F: FnOnce(&T) -> bool>(self, callback: F) -> Option<T>

Implementors§