WithMetadata

Struct WithMetadata 

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

A wrapper for a computation that attaches additional metadata.

This can be used to carry extra information alongside a computation.

Implementations§

Source§

impl<C, T> WithMetadata<C, T>

Source

pub const fn new(metadata: T, signal: C) -> WithMetadata<C, T>

Create a new computation with associated metadata.

Trait Implementations§

Source§

impl<C, T> Clone for WithMetadata<C, T>
where C: Clone, T: Clone,

Source§

fn clone(&self) -> WithMetadata<C, T>

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<C, T> Debug for WithMetadata<C, T>
where C: Debug, T: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<C, T> Signal for WithMetadata<C, T>
where C: Signal, T: Clone + 'static,

Implementation of signal for WithMetadata.

This delegates the computation to the wrapped value but enriches the watcher notifications with the metadata.

Source§

fn get(&self) -> <WithMetadata<C, T> as Signal>::Output

Execute the underlying computation.

Source§

fn watch( &self, watcher: impl Fn(Context<<WithMetadata<C, T> as Signal>::Output>) + 'static, ) -> <WithMetadata<C, T> as Signal>::Guard

Register a watcher, enriching notifications with the metadata.

Source§

type Output = <C as Signal>::Output

The type of value produced by this computation.
Source§

type Guard = <C as Signal>::Guard

The guard type returned by the watch method that manages watcher lifecycle.

Auto Trait Implementations§

§

impl<C, T> Freeze for WithMetadata<C, T>
where T: Freeze, C: Freeze,

§

impl<C, T> RefUnwindSafe for WithMetadata<C, T>

§

impl<C, T> Send for WithMetadata<C, T>
where T: Send, C: Send,

§

impl<C, T> Sync for WithMetadata<C, T>
where T: Sync, C: Sync,

§

impl<C, T> Unpin for WithMetadata<C, T>
where T: Unpin, C: Unpin,

§

impl<C, T> UnwindSafe for WithMetadata<C, T>
where T: UnwindSafe, C: UnwindSafe,

Blanket Implementations§

Source§

impl<S> AnimationExt for S
where S: SignalExt,

Source§

fn animated(self) -> WithMetadata<Self, Animation>
where Self: Sized,

Apply default animation to this reactive value Read more
Source§

fn with_animation(self, animation: Animation) -> WithMetadata<Self, Animation>
where Self: Sized,

Apply a specific animation to this reactive value Read more
§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<C, F, T1, T2, Output> FlattenMap<F, (T1, T2), Output> for C
where C: Signal<Output = (T1, T2)> + 'static, F: 'static + Clone + Fn(T1, T2) -> Output, T1: 'static, T2: 'static, Output: 'static,

Source§

fn flatten_map(self, f: F) -> Map<C, impl Clone + Fn((T1, T2)), Output>

Maps a function over the flattened elements of a nested tuple. Read more
Source§

impl<C, F, T1, T2, T3, Output> FlattenMap<F, (T1, T2, T3), Output> for C
where C: Signal<Output = ((T1, T2), T3)> + 'static, F: 'static + Clone + Fn(T1, T2, T3) -> Output, Output: 'static,

Source§

fn flatten_map(self, f: F) -> Map<C, impl Clone + Fn(((T1, T2), T3)), Output>

Maps a function over the flattened elements of a nested tuple. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> IdentifiableExt for T

Source§

fn use_id<F, Id>(self, f: F) -> UseId<Self, F>
where F: Fn(&Self) -> Id, Id: Ord + Hash,

Wraps the value in a UseId with the provided identification function.
Source§

fn self_id(self) -> SelfId<Self>

Wraps the value in a SelfId, making the value serve as its own identifier.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
§

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

§

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<C> SignalExt for C
where C: Signal,

Source§

fn map<F, Output>(self, f: F) -> Map<Self, F, Output>
where F: 'static + Clone + Fn(Self::Output) -> Output, Output: 'static, Self: 'static,

Transforms the output of this computation using the provided function. Read more
Source§

fn zip<B: Signal>(self, b: B) -> Zip<Self, B>
where Self::Output: Clone, B::Output: Clone,

Combines this computation with another computation. Read more
Source§

fn computed(self) -> Computed<Self::Output>
where Self: Clone + 'static,

Converts this computation into a Computed wrapper. Read more
Source§

fn with<T>(self, metadata: T) -> WithMetadata<Self, T>

Attaches metadata to this computation. Read more
Source§

fn animated(self) -> impl Signal<Output = Self::Output>

Marks this computation for animation with default settings. Read more
Source§

impl<C> SignalExt for C
where C: Signal,

Source§

fn map<F, Output>(self, f: F) -> Map<Self, F, Output>
where F: 'static + Clone + Fn(Self::Output) -> Output, Output: 'static, Self: 'static,

Transforms the output of this signal using the provided function.
Source§

fn zip<B>(self, b: B) -> Zip<Self, B>
where B: Signal, Self::Output: Clone, <B as Signal>::Output: Clone,

Combines this signal with another signal into a tuple.
Source§

fn cached(self) -> Cached<Self>
where Self::Output: Clone,

Wraps this signal with caching to avoid redundant computations.
Source§

fn computed(self) -> Computed<Self::Output>
where Self: 'static,

Converts this signal into a type-erased Computed container.
Source§

fn with<T>(self, metadata: T) -> WithMetadata<Self, T>

Attaches metadata to this signal’s watcher notifications.
Source§

fn debounce(self, duration: Duration) -> Debounce<Self, DefaultExecutor>
where Self::Output: Clone,

Creates a debounced version of this signal. Read more
Source§

fn throttle(self, duration: Duration) -> Throttle<Self, DefaultExecutor>
where Self::Output: Clone,

Creates a throttled version of this signal. Read more
§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more