Struct RwSignal

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

A read write Signal which can act as both a Getter and a Setter

Implementations§

Source§

impl<T> RwSignal<T>

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

Source§

impl<T: 'static> RwSignal<T>

Source

pub fn new(value: T) -> Self

Source

pub fn new_split(value: T) -> (ReadSignal<T>, WriteSignal<T>)

Trait Implementations§

Source§

impl<T: Add<Output = T> + 'static> Add<T> for RwSignal<T>
where for<'a> &'a T: Add<T, Output = T>,

Source§

type Output = T

The resulting type after applying the + operator.
Source§

fn add(self, rhs: T) -> Self::Output

Performs the + operation. Read more
Source§

impl<T: AddAssign + 'static> AddAssign<T> for RwSignal<T>

Source§

fn add_assign(&mut self, rhs: T)

Performs the += operation. Read more
Source§

impl<T: BitAnd<Output = T> + 'static> BitAnd<T> for RwSignal<T>
where for<'a> &'a T: BitAnd<T, Output = T>,

Source§

type Output = T

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: T) -> Self::Output

Performs the & operation. Read more
Source§

impl<T: BitAndAssign + 'static> BitAndAssign<T> for RwSignal<T>

Source§

fn bitand_assign(&mut self, rhs: T)

Performs the &= operation. Read more
Source§

impl<T: BitOr<Output = T> + 'static> BitOr<T> for RwSignal<T>
where for<'a> &'a T: BitOr<T, Output = T>,

Source§

type Output = T

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: T) -> Self::Output

Performs the | operation. Read more
Source§

impl<T: BitOrAssign + 'static> BitOrAssign<T> for RwSignal<T>

Source§

fn bitor_assign(&mut self, rhs: T)

Performs the |= operation. Read more
Source§

impl<T: BitXor<Output = T> + 'static> BitXor<T> for RwSignal<T>
where for<'a> &'a T: BitXor<T, Output = T>,

Source§

type Output = T

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: T) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<T: BitXorAssign + 'static> BitXorAssign<T> for RwSignal<T>

Source§

fn bitxor_assign(&mut self, rhs: T)

Performs the ^= operation. Read more
Source§

impl<T> Clone for RwSignal<T>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for RwSignal<T>

Source§

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

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

impl<T: Display + 'static> Display for RwSignal<T>

Source§

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

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

impl<T: Div<Output = T> + 'static> Div<T> for RwSignal<T>
where for<'a> &'a T: Div<T, Output = T>,

Source§

type Output = T

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T: DivAssign + 'static> DivAssign<T> for RwSignal<T>

Source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
Source§

impl<T: Mul<Output = T> + 'static> Mul<T> for RwSignal<T>
where for<'a> &'a T: Mul<T, Output = T>,

Source§

type Output = T

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: MulAssign + 'static> MulAssign<T> for RwSignal<T>

Source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
Source§

impl<T: 'static> Neg for RwSignal<T>
where for<'a> &'a T: Neg<Output = T>,

Source§

type Output = T

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<T: 'static> Not for RwSignal<T>
where for<'a> &'a T: Not<Output = T>,

Source§

type Output = T

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<T: PartialEq + 'static> PartialEq<T> for RwSignal<T>

Source§

fn eq(&self, other: &T) -> 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> PartialEq for RwSignal<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: Rem<Output = T> + 'static> Rem<T> for RwSignal<T>
where for<'a> &'a T: Rem<T, Output = T>,

Source§

type Output = T

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: T) -> Self::Output

Performs the % operation. Read more
Source§

impl<T: RemAssign + 'static> RemAssign<T> for RwSignal<T>

Source§

fn rem_assign(&mut self, rhs: T)

Performs the %= operation. Read more
Source§

impl<T: Shl<Output = T> + 'static> Shl<T> for RwSignal<T>
where for<'a> &'a T: Shl<T, Output = T>,

Source§

type Output = T

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: T) -> Self::Output

Performs the << operation. Read more
Source§

impl<T: ShlAssign + 'static> ShlAssign<T> for RwSignal<T>

Source§

fn shl_assign(&mut self, rhs: T)

Performs the <<= operation. Read more
Source§

impl<T: Shr<Output = T> + 'static> Shr<T> for RwSignal<T>
where for<'a> &'a T: Shr<T, Output = T>,

Source§

type Output = T

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: T) -> Self::Output

Performs the >> operation. Read more
Source§

impl<T: ShrAssign + 'static> ShrAssign<T> for RwSignal<T>

Source§

fn shr_assign(&mut self, rhs: T)

Performs the >>= operation. Read more
Source§

impl<T: Clone> SignalGet<T> for RwSignal<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> SignalRead<T> for RwSignal<T>

Source§

fn id(&self) -> Id

get the Signal Id
Source§

fn read(&self) -> ReadSignalValue<T>
where T: 'static,

Reads the data stored in the Signal to a RefCell, so that you can borrow() and access the data. It subscribes to the current running effect.
Source§

fn read_untracked(&self) -> ReadSignalValue<T>
where T: 'static,

Reads the data stored in the Signal to a RefCell, so that you can borrow() and access the data. It doesn’t subscribe to the current running effect.
Source§

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

If the signal isn’t disposed, reads the data stored in the Signal to a RefCell, so that you can borrow() and access the data. It subscribes to the current running effect.
Source§

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

If the signal isn’t disposed, reads the data stored in the Signal to a RefCell, so that you can borrow() and access the data. It doesn’t subscribe to the current running effect.
Source§

impl<T> SignalTrack<T> for RwSignal<T>

Source§

fn id(&self) -> Id

Source§

fn track(&self)

Only subscribes to the current running effect to this Signal.
Source§

fn try_track(&self)

If the signal isn’t disposed,
Source§

impl<T> SignalUpdate<T> for RwSignal<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 RwSignal<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> SignalWrite<T> for RwSignal<T>

Source§

fn id(&self) -> Id

get the Signal Id
Source§

fn write(&self) -> WriteSignalValue<T>
where T: 'static,

Convert the Signal to WriteSignalValue where it holds a RefCell wrapped original data of the signal, so that you can borrow_mut() to update the data. Read more
Source§

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

If the Signal isn’t disposed, convert the Signal to WriteSignalValue where it holds a RefCell wrapped original data of the signal, so that you can borrow_mut() to update the data. Read more
Source§

impl<T: Sub<Output = T> + 'static> Sub<T> for RwSignal<T>
where for<'a> &'a T: Sub<T, Output = T>,

Source§

type Output = T

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: T) -> Self::Output

Performs the - operation. Read more
Source§

impl<T: SubAssign + 'static> SubAssign<T> for RwSignal<T>

Source§

fn sub_assign(&mut self, rhs: T)

Performs the -= operation. Read more
Source§

impl<T> Copy for RwSignal<T>

Source§

impl<T> Eq for RwSignal<T>

Auto Trait Implementations§

§

impl<T> Freeze for RwSignal<T>

§

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

§

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

§

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

§

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

§

impl<T> UnwindSafe for RwSignal<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> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

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

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

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.