Struct fourleaf::unknown::UnknownFields
[−]
[src]
pub struct UnknownFields<'a>(pub Vec<(u8, UnknownField<'a>)>);
Stores a sequence of tags and the field values associated with them.
This is most useful in conjunction with the (?)
pseudo-tag of a structure
definition, as this will result in all unknown fields being preserved after
deserialisation and being replicated on serialisation.
Note that this won't be a 100% perfect replica, since all unknown fields in the reserialisation will be grouped together even if they were not in the original.
Beware that this cannot be used as a tagged field of a struct-like
composite, since its serialised format must use the tags it stores rather
than the tag of its container. Attempting to serialise such an
UnknownFields
instance will result in a panic! If you really want to pass
this around in a structure field, wrapping this in a 1-element array (i.e.,
[UnknownFields<'a>;1]
) will work.
Trait Implementations
impl<'a> Debug for UnknownFields<'a>
[src]
impl<'a> Clone for UnknownFields<'a>
[src]
fn clone(&self) -> UnknownFields<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<'a> PartialEq for UnknownFields<'a>
[src]
fn eq(&self, __arg_0: &UnknownFields<'a>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &UnknownFields<'a>) -> bool
This method tests for !=
.
impl<'a> Eq for UnknownFields<'a>
[src]
impl<'a> Default for UnknownFields<'a>
[src]
fn default() -> UnknownFields<'a>
Returns the "default value" for a type. Read more
impl<'a> Serialize for UnknownFields<'a>
[src]
fn serialize_body<R: Write>(&self, dst: &mut Stream<R>) -> Result<()>
Serialises this value, which is at top-level or the tail part of a struct. Read more
fn serialize_element<R: Write>(
&self,
dst: &mut Stream<R>,
tag: u8
) -> Result<()>
&self,
dst: &mut Stream<R>,
tag: u8
) -> Result<()>
Serialises this value, which is an element of a collection, to the given stream. Read more
fn serialize_field<R: Write>(&self, _: &mut Stream<R>, _: u8) -> Result<()>
Serialises this value, which is a field of a struct, to the given stream. Read more
fn serialize_slice<R: Write>(
selves: &[Self],
dst: &mut Stream<R>,
tag: u8
) -> Option<Result<()>> where
Self: Sized,
selves: &[Self],
dst: &mut Stream<R>,
tag: u8
) -> Option<Result<()>> where
Self: Sized,
If slices of this type should be written specially, do so and return Some
result. Otherwise, return None
. Read more
impl<'a, R: Read, STYLE> Deserialize<R, STYLE> for UnknownFields<'a> where
Cow<'a, [u8]>: Deserialize<R, STYLE>,
[src]
Cow<'a, [u8]>: Deserialize<R, STYLE>,
type Accum = Self
Type used to accumulate the deserialised value of this field. Read more
fn deserialize_body(context: &Context, stream: &mut Stream<R>) -> Result<Self>
Deserialises this type from a top-level stream or from the tail portion of a struct. If this call succeeds, all field elements up to and including the closing EndOfStruct
element are consumed. Read more
fn deserialize_field(
this: &mut Self,
context: &Context,
field: &mut Field<R>
) -> Result<()>
this: &mut Self,
context: &Context,
field: &mut Field<R>
) -> Result<()>
Deserialises this type from a field in a container. Read more
fn deserialize_element(context: &Context, field: &mut Field<R>) -> Result<Self>
Deserialises this type from a single field entry, which is known to be the only occurrence that would constitute this value. Read more
fn finish(this: Self, _: &Context) -> Result<Self>
Convert an accumulated value to a value of this type. Read more
fn serialized_as_slice() -> bool
Returns whether deserialize_vec
and the deserialize_array_*
methods return non-None. Read more
fn deserialize_vec(
context: &Context,
field: &mut Field<R>
) -> Option<Result<Vec<Self>>>
context: &Context,
field: &mut Field<R>
) -> Option<Result<Vec<Self>>>
If this type's Serialize
implementation has special behaviour in serialize_slice
, perform the reverse operation here and return a Vec
of values. Read more
fn deserialize_slice(
dst: &mut [Self],
context: &Context,
field: &mut Field<R>
) -> Option<Result<()>>
dst: &mut [Self],
context: &Context,
field: &mut Field<R>
) -> Option<Result<()>>
If this type's Serialize
implementation has special behaviour in serialize_slice
, perform the reverse operation here and write into the given slice of values, or return Err
if the slice is not the appropriate length. Read more
fn deserialize_array_0(
context: &Context,
field: &mut Field<R>
) -> Option<Result<[Self; 0]>>
context: &Context,
field: &mut Field<R>
) -> Option<Result<[Self; 0]>>
If this type's Serialize
implementation has special behaviour in serialize_slice
, perform the reverse operation here return an array of the given length, or return an error if the actual number of values is different from the length of the array. Read more