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 moresource§impl<T: 'static, S: Storage<T>> Writable for CopyValue<T, S>
impl<T: 'static, S: Storage<T>> Writable for CopyValue<T, S>
§type Mut<'a, R: ?Sized + 'static> = <S as AnyStorage>::Mut<'a, R>
type Mut<'a, R: ?Sized + 'static> = <S as AnyStorage>::Mut<'a, R>
source§fn map_mut<I: ?Sized, U: ?Sized, F: FnOnce(&mut I) -> &mut U>(
mut_: Self::Mut<'_, I>,
f: F,
) -> Self::Mut<'_, U>
fn map_mut<I: ?Sized, U: ?Sized, F: FnOnce(&mut I) -> &mut U>( mut_: Self::Mut<'_, I>, f: F, ) -> Self::Mut<'_, U>
source§fn try_map_mut<I: ?Sized, U: ?Sized, F: FnOnce(&mut I) -> Option<&mut U>>(
mut_: Self::Mut<'_, I>,
f: F,
) -> Option<Self::Mut<'_, U>>
fn try_map_mut<I: ?Sized, U: ?Sized, F: FnOnce(&mut I) -> Option<&mut U>>( mut_: Self::Mut<'_, I>, f: F, ) -> Option<Self::Mut<'_, U>>
source§fn downcast_lifetime_mut<'a: 'b, 'b, R: ?Sized + 'static>(
mut_: Self::Mut<'a, R>,
) -> Self::Mut<'b, R>
fn downcast_lifetime_mut<'a: 'b, 'b, R: ?Sized + 'static>( mut_: Self::Mut<'a, R>, ) -> Self::Mut<'b, R>
source§fn try_write_unchecked(
&self,
) -> Result<WritableRef<'static, Self>, BorrowMutError>
fn try_write_unchecked( &self, ) -> Result<WritableRef<'static, Self>, BorrowMutError>
source§fn set(&mut self, value: T)
fn set(&mut self, value: T)
source§fn write(&mut self) -> WritableRef<'_, Self>
fn write(&mut self) -> WritableRef<'_, Self>
source§fn try_write(&mut self) -> Result<WritableRef<'_, Self>, BorrowMutError>
fn try_write(&mut self) -> Result<WritableRef<'_, Self>, BorrowMutError>
source§fn write_unchecked(&self) -> WritableRef<'static, Self>
fn write_unchecked(&self) -> WritableRef<'static, Self>
impl<T, S: Storage<T>> Copy for CopyValue<T, S>
impl<T: 'static, S: Storage<T>> Eq for CopyValue<T, S>
Auto Trait Implementations§
impl<T, S> Freeze for CopyValue<T, S>
impl<T, S = UnsyncStorage> !RefUnwindSafe for CopyValue<T, S>
impl<T, S> Send for CopyValue<T, S>
impl<T, S> Sync for CopyValue<T, S>
impl<T, S> Unpin for CopyValue<T, S>where
T: Unpin,
impl<T, S = UnsyncStorage> !UnwindSafe for CopyValue<T, S>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)