Struct snapshot::any_snapshot::AnySnapshot
source · 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: Value
Implementations§
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§fn eq(&self, other: &AnySnapshot) -> bool
fn eq(&self, other: &AnySnapshot) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.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
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)