Struct FunctionComputed

Source
pub struct FunctionComputed<T, F, C> { /* private fields */ }
Expand description

A computed T which is produced by some function F.

Created by the ComputedVar::new function or computed macro.

Implementations§

Source§

impl<T, F, C> FunctionComputed<T, F, C>
where F: FnMut(&mut C) -> T,

Source

pub fn new(func: F) -> Self

Creates the computed T.

Trait Implementations§

Source§

impl<T, F, C> ComputedValue for FunctionComputed<T, F, C>
where F: FnMut(&mut C) -> T,

Source§

type Value = T

The value visible within the ComputedVar.
Source§

type Context = C

The context used by the update function.
Source§

fn update(&mut self, ctx: &mut C, _comp: &ComputationHandle)

Recompute the value of this item.
Source§

fn read(&self) -> &T

Cheaply get a reference to the value of this item. This function is free to panic if update has never been called.

Auto Trait Implementations§

§

impl<T, F, C> Freeze for FunctionComputed<T, F, C>
where F: Freeze, T: Freeze,

§

impl<T, F, C> RefUnwindSafe for FunctionComputed<T, F, C>

§

impl<T, F, C> Send for FunctionComputed<T, F, C>
where F: Send, T: Send, C: Send,

§

impl<T, F, C> Sync for FunctionComputed<T, F, C>
where F: Sync, T: Sync, C: Sync,

§

impl<T, F, C> Unpin for FunctionComputed<T, F, C>
where F: Unpin, T: Unpin, C: Unpin,

§

impl<T, F, C> UnwindSafe for FunctionComputed<T, F, C>
where F: UnwindSafe, T: UnwindSafe, C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.