pub struct CopyValue<T, S = UnsyncStorage>where
S: 'static,{ /* private fields */ }prelude only.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> CopyValue<T>where
T: 'static,
impl<T> CopyValue<T>where
T: 'static,
Sourcepub fn new(value: T) -> CopyValue<T>
pub fn new(value: T) -> CopyValue<T>
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) -> CopyValue<T>
pub fn new_in_scope(value: T, scope: ScopeId) -> CopyValue<T>
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, S> CopyValue<T, S>where
S: Storage<T>,
impl<T, S> CopyValue<T, S>where
S: Storage<T>,
Sourcepub fn new_maybe_sync(value: T) -> CopyValue<T, S>where
T: 'static,
pub fn new_maybe_sync(value: T) -> CopyValue<T, S>where
T: 'static,
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 leak_with_caller(
value: T,
caller: &'static Location<'static>,
) -> CopyValue<T, S>where
T: 'static,
pub fn leak_with_caller(
value: T,
caller: &'static Location<'static>,
) -> CopyValue<T, S>where
T: 'static,
Create a new CopyValue without an owner. This will leak memory if you don’t manually drop it.
Sourcepub fn point_to(&self, other: CopyValue<T, S>) -> Result<(), BorrowError>
pub fn point_to(&self, other: CopyValue<T, S>) -> Result<(), BorrowError>
Point to another copy value
Sourcepub fn new_maybe_sync_in_scope(value: T, scope: ScopeId) -> CopyValue<T, S>
pub fn new_maybe_sync_in_scope(value: T, scope: ScopeId) -> CopyValue<T, S>
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 new_maybe_sync_in_scope_with_caller(
value: T,
scope: ScopeId,
caller: &'static Location<'static>,
) -> CopyValue<T, S>
pub fn new_maybe_sync_in_scope_with_caller( value: T, scope: ScopeId, caller: &'static Location<'static>, ) -> CopyValue<T, S>
Create a new CopyValue with a custom caller. 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)where
T: 'static,
pub fn manually_drop(&self)where
T: 'static,
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.
Sourcepub fn value(&self) -> GenerationalBox<T, S>
pub fn value(&self) -> GenerationalBox<T, S>
Get the underlying GenerationalBox value.
Trait Implementations§
Source§impl<T, S> AddAssign<T> for CopyValue<T, S>
impl<T, S> 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, S> DivAssign<T> for CopyValue<T, S>
impl<T, S> 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, S> From<CopyValue<T, S>> for ReadSignal<T, S>where
T: 'static,
S: CreateBoxedSignalStorage<CopyValue<T, S>> + BoxedSignalStorage<T> + Storage<T>,
impl<T, S> From<CopyValue<T, S>> for ReadSignal<T, S>where
T: 'static,
S: CreateBoxedSignalStorage<CopyValue<T, S>> + BoxedSignalStorage<T> + Storage<T>,
Source§fn from(value: CopyValue<T, S>) -> ReadSignal<T, S>
fn from(value: CopyValue<T, S>) -> ReadSignal<T, S>
Source§impl<T, S> From<CopyValue<T, S>> for WriteSignal<T, S>where
T: 'static,
S: CreateBoxedSignalStorage<CopyValue<T, S>> + BoxedSignalStorage<T> + Storage<T>,
impl<T, S> From<CopyValue<T, S>> for WriteSignal<T, S>where
T: 'static,
S: CreateBoxedSignalStorage<CopyValue<T, S>> + BoxedSignalStorage<T> + Storage<T>,
Source§fn from(value: CopyValue<T, S>) -> WriteSignal<T, S>
fn from(value: CopyValue<T, S>) -> WriteSignal<T, S>
Source§impl<T, S> MulAssign<T> for CopyValue<T, S>
impl<T, S> 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, S> PartialEq for CopyValue<T, S>where
S: AnyStorage,
impl<T, S> PartialEq for CopyValue<T, S>where
S: AnyStorage,
Source§impl<T, S> Readable for CopyValue<T, S>where
S: Storage<T>,
impl<T, S> Readable for CopyValue<T, S>where
S: Storage<T>,
Source§fn try_read_unchecked(
&self,
) -> Result<<<CopyValue<T, S> as Readable>::Storage as AnyStorage>::Ref<'static, <CopyValue<T, S> as Readable>::Target>, BorrowError>
fn try_read_unchecked( &self, ) -> Result<<<CopyValue<T, S> as Readable>::Storage as AnyStorage>::Ref<'static, <CopyValue<T, S> as Readable>::Target>, BorrowError>
Source§fn try_peek_unchecked(
&self,
) -> Result<<<CopyValue<T, S> as Readable>::Storage as AnyStorage>::Ref<'static, <CopyValue<T, S> as Readable>::Target>, BorrowError>
fn try_peek_unchecked( &self, ) -> Result<<<CopyValue<T, S> as Readable>::Storage as AnyStorage>::Ref<'static, <CopyValue<T, S> as Readable>::Target>, BorrowError>
Source§fn subscribers(&self) -> Subscribers
fn subscribers(&self) -> Subscribers
Source§impl<T, S> SubAssign<T> for CopyValue<T, S>
impl<T, S> 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, S> Writable for CopyValue<T, S>where
S: Storage<T>,
impl<T, S> Writable for CopyValue<T, S>where
S: Storage<T>,
Source§type WriteMetadata = ()
type WriteMetadata = ()
Source§fn try_write_unchecked(
&self,
) -> Result<WriteLock<'static, <CopyValue<T, S> as Readable>::Target, <CopyValue<T, S> as Readable>::Storage, <CopyValue<T, S> as Writable>::WriteMetadata>, BorrowMutError>
fn try_write_unchecked( &self, ) -> Result<WriteLock<'static, <CopyValue<T, S> as Readable>::Target, <CopyValue<T, S> as Readable>::Storage, <CopyValue<T, S> as Writable>::WriteMetadata>, BorrowMutError>
impl<T, S> Copy for CopyValue<T, S>
impl<T, S> Eq for CopyValue<T, S>where
S: AnyStorage,
Auto Trait Implementations§
impl<T, S> Freeze for CopyValue<T, S>
impl<T, S> RefUnwindSafe for CopyValue<T, S>where
T: RefUnwindSafe,
S: RefUnwindSafe,
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> UnwindSafe for CopyValue<T, S>where
T: UnwindSafe,
S: RefUnwindSafe,
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§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R> ReadableBoxExt for R
impl<R> ReadableBoxExt for R
Source§impl<R> ReadableExt for R
impl<R> ReadableExt for R
Source§fn read(&self) -> <Self::Storage as AnyStorage>::Ref<'_, Self::Target>where
Self::Target: 'static,
fn read(&self) -> <Self::Storage as AnyStorage>::Ref<'_, Self::Target>where
Self::Target: 'static,
Source§fn try_read(
&self,
) -> Result<<Self::Storage as AnyStorage>::Ref<'_, Self::Target>, BorrowError>where
Self::Target: 'static,
fn try_read(
&self,
) -> Result<<Self::Storage as AnyStorage>::Ref<'_, Self::Target>, BorrowError>where
Self::Target: 'static,
Source§fn read_unchecked(
&self,
) -> <Self::Storage as AnyStorage>::Ref<'static, Self::Target>where
Self::Target: 'static,
fn read_unchecked(
&self,
) -> <Self::Storage as AnyStorage>::Ref<'static, Self::Target>where
Self::Target: 'static,
Source§fn peek(&self) -> <Self::Storage as AnyStorage>::Ref<'_, Self::Target>where
Self::Target: 'static,
fn peek(&self) -> <Self::Storage as AnyStorage>::Ref<'_, Self::Target>where
Self::Target: 'static,
Source§fn try_peek(
&self,
) -> Result<<Self::Storage as AnyStorage>::Ref<'_, Self::Target>, BorrowError>where
Self::Target: 'static,
fn try_peek(
&self,
) -> Result<<Self::Storage as AnyStorage>::Ref<'_, Self::Target>, BorrowError>where
Self::Target: 'static,
Source§fn peek_unchecked(
&self,
) -> <Self::Storage as AnyStorage>::Ref<'static, Self::Target>where
Self::Target: 'static,
fn peek_unchecked(
&self,
) -> <Self::Storage as AnyStorage>::Ref<'static, Self::Target>where
Self::Target: 'static,
Source§fn map<F, O>(self, f: F) -> MappedSignal<O, Self, F>
fn map<F, O>(self, f: F) -> MappedSignal<O, Self, F>
Source§fn cloned(&self) -> Self::Target
fn cloned(&self) -> Self::Target
Source§fn with<O>(&self, f: impl FnOnce(&Self::Target) -> O) -> Owhere
Self::Target: 'static,
fn with<O>(&self, f: impl FnOnce(&Self::Target) -> O) -> Owhere
Self::Target: 'static,
Source§impl<K, V, H, R> ReadableHashMapExt<K, V, H> for R
impl<K, V, H, R> ReadableHashMapExt<K, V, H> for R
Source§impl<V, H, R> ReadableHashSetExt<V, H> for R
impl<V, H, R> ReadableHashSetExt<V, H> for R
Source§impl<T, R> ReadableOptionExt<T> for R
impl<T, R> ReadableOptionExt<T> for R
Source§impl<T, E, R> ReadableResultExt<T, E> for R
impl<T, E, R> ReadableResultExt<T, E> for R
Source§fn unwrap(&self) -> Twhere
T: Clone + 'static,
E: 'static,
fn unwrap(&self) -> Twhere
T: Clone + 'static,
E: 'static,
Source§fn as_ref(
&self,
) -> Result<<Self::Storage as AnyStorage>::Ref<'_, T>, <Self::Storage as AnyStorage>::Ref<'_, E>>where
T: 'static,
E: 'static,
fn as_ref(
&self,
) -> Result<<Self::Storage as AnyStorage>::Ref<'_, T>, <Self::Storage as AnyStorage>::Ref<'_, E>>where
T: 'static,
E: 'static,
Source§impl<W> ReadableStringExt for W
impl<W> ReadableStringExt for W
Source§impl<T, R> ReadableVecExt<T> for R
impl<T, R> ReadableVecExt<T> for R
Source§fn first(&self) -> Option<<Self::Storage as AnyStorage>::Ref<'_, T>>where
T: 'static,
fn first(&self) -> Option<<Self::Storage as AnyStorage>::Ref<'_, T>>where
T: 'static,
Source§fn last(&self) -> Option<<Self::Storage as AnyStorage>::Ref<'_, T>>where
T: 'static,
fn last(&self) -> Option<<Self::Storage as AnyStorage>::Ref<'_, T>>where
T: 'static,
Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.