pub struct Canary1 {}
Expand description
Useful zero-sized marker. 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 PartialEq for Canary1
impl PartialEq for Canary1
source§impl ReprC for Canary1
impl ReprC for Canary1
source§unsafe fn repr_c_optimization_safe(_version: u32) -> IsReprC
unsafe fn repr_c_optimization_safe(_version: u32) -> IsReprC
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 given protocol 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.
In versions prior to 0.15, ‘Serializer’ did not accept a type parameter.
It now requires a type parameter with the type of writer expected.
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 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<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.