pub struct RawItem { /* private fields */ }Expand description
A stored entry containing the serialized representation and an optional cached runtime value.
serialized: theserde_value::Valueused for Serialize/Deserialize of the map.value: an optionalBox<dyn Any>holding the deserialized value. This field is not serialized and is cleared onCloneandDeserialize.
Semantics:
- On
insert, bothserializedandvalueare populated. - On access (
get/get_mut), the entry will lazily deserializeserializedintovalueif the cache is empty. into_innerattempts to extract the concrete type from the cache or by deserializing.
Notes:
- The cloning, serialization and deserialization happens based on the serialized
serde_value::Value, so any modifications to fields that are marked#[serde(skip)]will not be lost after a serialization round-trip, or after cloning the map. - Currently any modifications to the cached
valueare not reflected back into theserializedform, so serialization WILL reflect the original value only. This is a known limitation and is planned to be addressed in a future version by returning a Guard object that will update the serialized value on Drop.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RawItem
impl<'de> Deserialize<'de> for RawItem
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RawItem
impl !RefUnwindSafe for RawItem
impl !Send for RawItem
impl !Sync for RawItem
impl Unpin for RawItem
impl !UnwindSafe for RawItem
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
Mutably borrows from an owned value. Read more