Trait deser::Descriptor
source · [−]pub trait Descriptor {
fn name(&self) -> Option<&str> { ... }
fn precision(&self) -> Option<usize> { ... }
fn unordered(&self) -> bool { ... }
}Expand description
A descriptor provides auxiliary type information.
Many types upon serialization coerce their value into a common atomic
value which is native to the deser data model. This causes challenges
when a serializer needs to tell the difference between the original values.
For instance a serializer might be interested in being able to tell a
u8 from a u64 despite the fact that both are represented equally.
During serialization descriptors are generally created, for the deserialization system descriptors are only used when entering into a nested structure such as a map, struct or sequence.
Provided methods
Returns a descriptive name for a type if such a name is available.
Returns the precision in bits of the value.
This is normally set for numbers and returns the natural bit count of
the source information. For instancen a u32 will return Some(32)
from this method.