pub struct Shared<T: 'static, B: 'static> {
    pub id: Option<usize>,
    /* private fields */
}
Expand description

A hook to a shared_value.

This is generally created by calling use_rw or use_w on a shareable!, or by calling ListEntry::use_rw or ListEntry::use_w.

Fields

id: Option<usize>

Implementations

Initialize the hook in scope cx.

The shared value will be initialized with f() if it hasn’t been created yet.

NOTE: this method should generally not be used directly; instead, shared values are usually created with shareable!.

Obtain a write pointer to the shared value and register the change.

This will mark all components which hold a RW link to the value as needing update.

Obtain a write pointer to the shared value but do not register the change.

This will not notify consumers of the change to the value.

Mark the components which hold a RW link to the value as needing update.

Set the shared value.

This marks compoments which hold a RW link to the value as needing update if and only if the value has changed.

Set the shared value to f(&x) where x is the current value.

This marks components which hold a RW link to the value as needing update if and only if the value has changed.

Get the value of the shared data.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.