pub struct Canary1 {}Expand description
A zero-sized marker for troubleshooting purposes.
It serializes to a magic value, and verifies this value on deserialization. Does not consume memory data structure. Useful to troubleshoot broken Serialize/Deserialize implementations.
Implementations§
Trait Implementations§
Source§impl Deserialize for Canary1
impl Deserialize for Canary1
Source§fn deserialize(
deserializer: &mut Deserializer<'_, impl Read>,
) -> Result<Self, SavefileError>
fn deserialize( deserializer: &mut Deserializer<'_, impl Read>, ) -> Result<Self, SavefileError>
Deserialize and return an instance of Self from the given deserializer.
Source§impl Introspect for Canary1
impl Introspect for Canary1
Source§fn introspect_value(&self) -> String
fn introspect_value(&self) -> String
Returns the value of the object, excluding children, as a string.
Exactly what the value returned here is depends on the type.
For some types, like a plain array, there isn’t much of a value,
the entire information of object resides in the children.
For other cases, like a department in an organisation, it might
make sense to have the value be the name, and have all the other properties
as children.
Source§fn introspect_child(
&self,
_index: usize,
) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
Returns an the name and &dyn Introspect for the child with the given index,
or if no child with that index exists, None.
All the children should be indexed consecutively starting at 0 with no gaps,
all though there isn’t really anything stopping the user of the trait to have
any arbitrary index strategy, consecutive numbering 0, 1, 2, … etc is strongly
encouraged.
Source§fn introspect_len(&self) -> usize
fn introspect_len(&self) -> usize
Returns the total number of children.
The default implementation calculates this by simply calling introspect_child with
higher and higher indexes until it returns None.
It gives up if the count reaches 10000. If your type can be bigger
and you want to be able to introspect it, override this method.
Source§impl Packed for Canary1
impl Packed for Canary1
Source§unsafe fn repr_c_optimization_safe(_version: u32) -> IsPacked
unsafe fn repr_c_optimization_safe(_version: u32) -> IsPacked
This method returns true if the optimization is allowed
for the protocol version given as an argument.
This may return true if and only if the given protocol version
has a serialized format identical to the memory layout of the given protocol version.
Note, the only memory layout existing is that of the most recent version, so
Packed-optimization only works when disk-format is identical to memory version. Read more
Source§impl Serialize for Canary1
impl Serialize for Canary1
Source§fn serialize(
&self,
serializer: &mut Serializer<'_, impl Write>,
) -> Result<(), SavefileError>
fn serialize( &self, serializer: &mut Serializer<'_, impl Write>, ) -> Result<(), SavefileError>
Serialize self into the given serializer. Read more
Source§impl WithSchema for Canary1
impl WithSchema for Canary1
impl Copy for Canary1
impl Eq for Canary1
impl StructuralPartialEq for Canary1
Auto Trait Implementations§
impl Freeze for Canary1
impl RefUnwindSafe for Canary1
impl Send for Canary1
impl Sync for Canary1
impl Unpin for Canary1
impl UnwindSafe for Canary1
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
Compare self to
key and return true if they are equal.