INNER CODE UNIT · Rust
filter
fishfolk/bones · framework_crates/bones_asset/src/lib.rs:157
pub fn filter<P: FnOnce(&T) -> bool>(self, predicate: P) -> Maybe<T> {
self.option().filter(predicate).into()
}
/// Returns the option if it contains a value, otherwise returns `optb`.
#[inline]
pub fn or(self, optb: Maybe<T>) -> Maybe<T> {
self.option().or(optb.option()).into()
}
/// Returns the option if it contains a value, otherwise calls `f` and returns the result.
#[inline]
pub fn or_else<F: FnOnce() -> Maybe<T>>(self, f: F) -> Maybe<T> {
self.option().or_else(|| f().option()).into()
}
/// Returns `Set` if exactly one of `self`, `optb` is `Set`, otherwise returns `Unset`.
#[inline]