OptionDatumExt

Trait OptionDatumExt 

Source
pub trait OptionDatumExt<T> {
    // Required methods
    fn replace_if_none_or_older_than(
        &mut self,
        maybe_replace_with: Datum<T>,
    ) -> bool;
    fn replace_if_none_or_older_than_option(
        &mut self,
        maybe_replace_with: Self,
    ) -> bool;
}
Expand description

Extension trait for Option<Datum<T>>.

Required Methods§

Source

fn replace_if_none_or_older_than( &mut self, maybe_replace_with: Datum<T>, ) -> bool

If self is None, replaces it with Some(maybe_replace_with). If self is Some, replaces it with Some(maybe_replace_with) if maybe_replace_with’s timestamp is newer than its. Returns true if self was replaced and false otherwise.

Source

fn replace_if_none_or_older_than_option( &mut self, maybe_replace_with: Self, ) -> bool

If maybe_replace_with is Some, calls replace_if_none_or_older_than. If it is None, returns false immediately.

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> OptionDatumExt<T> for Option<Datum<T>>

Source§

fn replace_if_none_or_older_than( &mut self, maybe_replace_with: Datum<T>, ) -> bool

Source§

fn replace_if_none_or_older_than_option( &mut self, maybe_replace_with: Self, ) -> bool

Implementors§