Struct BaseSignal

Source
pub struct BaseSignal<T> { /* private fields */ }
Expand description

BaseSignal gives you another way to control the lifetime of a Signal apart from Scope.

When BaseSignal is dropped, it will dispose the underlying Signal as well. The signal isn’t put in any Scope when a BaseSignal is created, so that the lifetime of the signal can only be determined by BaseSignal rather than Scope dependencies

Implementations§

Source§

impl<T> BaseSignal<T>

Source

pub fn rw(&self) -> RwSignal<T>

Create a RwSignal of this Signal

Source

pub fn read_only(&self) -> ReadSignal<T>

Create a Getter of this Signal

Source

pub fn write_only(&self) -> WriteSignal<T>

Create a Setter of this Signal

Trait Implementations§

Source§

impl<T> Drop for BaseSignal<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T> PartialEq for BaseSignal<T>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Clone> SignalGet<T> for BaseSignal<T>

Source§

fn id(&self) -> Id

get the Signal Id
Source§

fn get_untracked(&self) -> T
where T: 'static,

Clones and returns the current value stored in the Signal, but it doesn’t subscribe to the current running effect.
Source§

fn get(&self) -> T
where T: 'static,

Clones and returns the current value stored in the Signal, and subscribes to the current running effect to this Signal.
Source§

fn try_get(&self) -> Option<T>
where T: 'static,

Try to clone and return the current value stored in the Signal, and returns None if it’s already disposed. It subscribes to the current running effect.
Source§

fn try_get_untracked(&self) -> Option<T>
where T: 'static,

Try to clone and return the current value stored in the Signal, and returns None if it’s already disposed. It doesn’t subscribe to the current running effect.
Source§

impl<T> SignalUpdate<T> for BaseSignal<T>

Source§

fn id(&self) -> Id

get the Signal Id
Source§

fn set(&self, new_value: T)
where T: 'static,

Sets the new_value to the Signal and triggers effect run
Source§

fn update(&self, f: impl FnOnce(&mut T))
where T: 'static,

Update the stored value with the given function and triggers effect run
Source§

fn try_update<O>(&self, f: impl FnOnce(&mut T) -> O) -> Option<O>
where T: 'static,

Update the stored value with the given function, triggers effect run, and returns the value returned by the function
Source§

impl<T> SignalWith<T> for BaseSignal<T>

Source§

fn id(&self) -> Id

get the Signal Id
Source§

fn with<O>(&self, f: impl FnOnce(&T) -> O) -> O
where T: 'static,

Applies a closure to the current value stored in the Signal, and subscribes to the current running effect to this Memo.
Source§

fn with_untracked<O>(&self, f: impl FnOnce(&T) -> O) -> O
where T: 'static,

Applies a closure to the current value stored in the Signal, but it doesn’t subscribe to the current running effect.
Source§

fn try_with<O>(&self, f: impl FnOnce(Option<&T>) -> O) -> O
where T: 'static,

If the signal isn’t disposed, applies a closure to the current value stored in the Signal. It subscribes to the current running effect.
Source§

fn try_with_untracked<O>(&self, f: impl FnOnce(Option<&T>) -> O) -> O
where T: 'static,

If the signal isn’t disposed, applies a closure to the current value stored in the Signal, but it doesn’t subscribe to the current running effect.
Source§

impl<T> Eq for BaseSignal<T>

Auto Trait Implementations§

§

impl<T> Freeze for BaseSignal<T>

§

impl<T> RefUnwindSafe for BaseSignal<T>
where T: RefUnwindSafe,

§

impl<T> Send for BaseSignal<T>
where T: Send,

§

impl<T> Sync for BaseSignal<T>
where T: Sync,

§

impl<T> Unpin for BaseSignal<T>
where T: Unpin,

§

impl<T> UnwindSafe for BaseSignal<T>
where T: 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.