Struct dioxus_signals::CopyValue
source · pub struct CopyValue<T: 'static, S: Storage<T> = UnsyncStorage> { /* private fields */ }Expand description
CopyValue is a wrapper around a value to make the value mutable and Copy.
It is internally backed by generational_box::GenerationalBox.
Implementations§
source§impl<T: 'static> CopyValue<T>
impl<T: 'static> CopyValue<T>
sourcepub fn new(value: T) -> Self
pub fn new(value: T) -> Self
Create a new CopyValue. The value will be stored in the current component.
Once the component this value is created in is dropped, the value will be dropped.
sourcepub fn new_in_scope(value: T, scope: ScopeId) -> Self
pub fn new_in_scope(value: T, scope: ScopeId) -> Self
Create a new CopyValue. The value will be stored in the given scope. When the specified scope is dropped, the value will be dropped.
source§impl<T: 'static, S: Storage<T>> CopyValue<T, S>
impl<T: 'static, S: Storage<T>> CopyValue<T, S>
sourcepub fn new_maybe_sync(value: T) -> Self
pub fn new_maybe_sync(value: T) -> Self
Create a new CopyValue. The value will be stored in the current component.
Once the component this value is created in is dropped, the value will be dropped.
sourcepub fn new_maybe_sync_in_scope(value: T, scope: ScopeId) -> Self
pub fn new_maybe_sync_in_scope(value: T, scope: ScopeId) -> Self
Create a new CopyValue. The value will be stored in the given scope. When the specified scope is dropped, the value will be dropped.
sourcepub fn manually_drop(&self) -> Option<T>
pub fn manually_drop(&self) -> Option<T>
Manually drop the value in the CopyValue, invalidating the value in the process.
sourcepub fn origin_scope(&self) -> ScopeId
pub fn origin_scope(&self) -> ScopeId
Get the scope this value was created in.
sourcepub fn id(&self) -> GenerationalBoxId
pub fn id(&self) -> GenerationalBoxId
Get the generational id of the value.
Trait Implementations§
source§impl<T: Add<Output = T> + Copy + 'static, S: Storage<T>> AddAssign<T> for CopyValue<T, S>
impl<T: Add<Output = T> + Copy + 'static, S: Storage<T>> AddAssign<T> for CopyValue<T, S>
source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
+= operation. Read moresource§impl<T: Div<Output = T> + Copy + 'static, S: Storage<T>> DivAssign<T> for CopyValue<T, S>
impl<T: Div<Output = T> + Copy + 'static, S: Storage<T>> DivAssign<T> for CopyValue<T, S>
source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
/= operation. Read moresource§impl<T: Mul<Output = T> + Copy + 'static, S: Storage<T>> MulAssign<T> for CopyValue<T, S>
impl<T: Mul<Output = T> + Copy + 'static, S: Storage<T>> MulAssign<T> for CopyValue<T, S>
source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
*= operation. Read moresource§impl<T: 'static, S: Storage<T>> PartialEq for CopyValue<T, S>
impl<T: 'static, S: Storage<T>> PartialEq for CopyValue<T, S>
source§impl<T: 'static, S: Storage<T>> Readable for CopyValue<T, S>
impl<T: 'static, S: Storage<T>> Readable for CopyValue<T, S>
source§fn try_read_unchecked(&self) -> Result<ReadableRef<'static, Self>, BorrowError>
fn try_read_unchecked(&self) -> Result<ReadableRef<'static, Self>, BorrowError>
source§fn peek_unchecked(&self) -> ReadableRef<'static, Self>
fn peek_unchecked(&self) -> ReadableRef<'static, Self>
source§fn map<O>(
self,
f: impl Fn(&Self::Target) -> &O + 'static
) -> MappedSignal<O, Self::Storage>
fn map<O>( self, f: impl Fn(&Self::Target) -> &O + 'static ) -> MappedSignal<O, Self::Storage>
source§fn read(&self) -> ReadableRef<'_, Self>
fn read(&self) -> ReadableRef<'_, Self>
source§fn try_read(&self) -> Result<ReadableRef<'_, Self>, BorrowError>
fn try_read(&self) -> Result<ReadableRef<'_, Self>, BorrowError>
source§fn read_unchecked(&self) -> ReadableRef<'static, Self>
fn read_unchecked(&self) -> ReadableRef<'static, Self>
source§fn peek(&self) -> ReadableRef<'_, Self>
fn peek(&self) -> ReadableRef<'_, Self>
source§fn with<O>(&self, f: impl FnOnce(&Self::Target) -> O) -> O
fn with<O>(&self, f: impl FnOnce(&Self::Target) -> O) -> O
source§impl<T: Sub<Output = T> + Copy + 'static, S: Storage<T>> SubAssign<T> for CopyValue<T, S>
impl<T: Sub<Output = T> + Copy + 'static, S: Storage<T>> SubAssign<T> for CopyValue<T, S>
source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
-= operation. Read more