pub struct AnySnapshot(Value);Expand description
A type erased snapshot value. Or, alternatively, you can think of it as a partially (de)serialized value that can be nested in other values without incurring double encoding in the final output.
There is a performance and code size cost to this type, so only use it if really needed, for example, in traits that must be dyn compatible.
If the intermediate representation and the final serialization format don’t match, for example,
if AnySnapshot was implemented with serde_json::Value but then written to a file as CBOR,
it will technically work, but the result might not match what you’d get if you directly
serialized the original value. That should be OK as long as the serialization and
deserialization paths make symmetric use of AnySnapshot.
Tuple Fields§
§0: ValueImplementations§
Trait Implementations§
Source§impl Clone for AnySnapshot
impl Clone for AnySnapshot
Source§fn clone(&self) -> AnySnapshot
fn clone(&self) -> AnySnapshot
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AnySnapshot
impl Debug for AnySnapshot
Source§impl<'de> Deserialize<'de> for AnySnapshot
impl<'de> Deserialize<'de> for AnySnapshot
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
Source§impl PartialEq for AnySnapshot
impl PartialEq for AnySnapshot
Source§impl Serialize for AnySnapshot
impl Serialize for AnySnapshot
impl StructuralPartialEq for AnySnapshot
Auto Trait Implementations§
impl Freeze for AnySnapshot
impl RefUnwindSafe for AnySnapshot
impl Send for AnySnapshot
impl Sync for AnySnapshot
impl Unpin for AnySnapshot
impl UnwindSafe for AnySnapshot
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