Struct actyx_sdk::types::ArcVal [−][src]
#[repr(transparent)]pub struct ArcVal<T: ?Sized>(_);
Expand description
Interned and reference-counted immutable value
This type is a building block for handling large amounts of data with recurring heap-allocated
values, like strings for event types and entity names, but also binary data blocks that are
potentially loaded into memory multiple times. The arcval_scalar!
macro makes it easy to tag data to denote different kinds of objects.
This also serves as a helper type that allows an Arc
to be included in a data structure that is serialized/deserialized with
Abomonation
.
use actyx_sdk::types::ArcVal; let s: ArcVal<str> = ArcVal::clone_from_unsized("hello"); let b: ArcVal<[u8; 5]> = ArcVal::from_sized([49, 50, 51, 52, 53]); let v: ArcVal<[u8]> = ArcVal::from_boxed(vec![49, 50, 51, 52, 53].into()); assert_eq!(&*s, "hello"); assert_eq!(&*b, b"12345"); assert_eq!(&*v, b"12345");
Caveat Emptor
It is obviously a very bad idea to intern objects that offer internal mutability, so don’t do that.
Implementations
Trait Implementations
This abomination only works if the underlying bytes are known in number (Sized), can be moved around in memory (Unpin) and do no hold on to other things than the underlying bytes (’static).
impl<'de, T> Deserialize<'de> for ArcVal<T> where
T: Deserialize<'de> + Sized + Eq + Hash + Ord + Send + Sync + 'static,
[src]
impl<'de, T> Deserialize<'de> for ArcVal<T> where
T: Deserialize<'de> + Sized + Eq + Hash + Ord + Send + Sync + 'static,
[src]Deserialize this value from the given Serde deserializer. Read more
Deserialize this value from the given Serde deserializer. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl<T: ?Sized> RefUnwindSafe for ArcVal<T> where
T: RefUnwindSafe,
impl<T: ?Sized> UnwindSafe for ArcVal<T> where
T: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Casts the value.
Compare self to key
and return true
if they are equal.
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Performs the conversion.
Performs the conversion.
Casts the value.
Casts the value.
Casts the value.
Casts the value.