Skip to main content

WithUntrackedOptional

Trait WithUntrackedOptional 

pub trait WithUntrackedOptional: DefinedAt {
    type Value: ?Sized;

    // Required method
    fn try_with_untracked<U>(
        &self,
        fun: impl FnOnce(Option<&Self::Value>) -> U,
    ) -> Option<U>;

    // Provided method
    fn with_untracked<U>(
        &self,
        fun: impl FnOnce(Option<&Self::Value>) -> U,
    ) -> U { ... }
}
Expand description

An alternative WithUntracked trait that works with Option<Withable> types.

Required Associated Types§

type Value: ?Sized

The type of the value contained in the signal.

Required Methods§

fn try_with_untracked<U>( &self, fun: impl FnOnce(Option<&Self::Value>) -> U, ) -> Option<U>

Applies the closure to the value, and returns the result, or None if the signal has already been disposed.

Provided Methods§

fn with_untracked<U>(&self, fun: impl FnOnce(Option<&Self::Value>) -> U) -> U

Applies the closure to the value, and returns the result.

§Panics

Panics if you try to access a signal that has been disposed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl<T> WithUntrackedOptional for Option<T>

§

type Value = <T as WithUntracked>::Value

§

fn try_with_untracked<U>( &self, fun: impl FnOnce(Option<&<Option<T> as WithUntrackedOptional>::Value>) -> U, ) -> Option<U>

Implementors§