Trait concordium_std::Deserial [−][src]
pub trait Deserial { fn deserial<R>(_source: &mut R) -> Result<Self, ParseError>
where
R: Read; }
Expand description
The Deserial
trait provides a means of reading structures from byte-sinks
(Read
).
Can be derived using #[derive(Deserial)]
for most cases.
Required methods
fn deserial<R>(_source: &mut R) -> Result<Self, ParseError> where
R: Read,
[src]
R: Read,
Expand description
Attempt to read a structure from a given source, failing if an error occurs during deserialization or reading.
Implementations on Foreign Types
impl Deserial for bool
[src]
impl Deserial for bool
[src]Deserializing a bool
reads one byte, and returns the value false
if the
byte is 0u8
and true
if the byte is 1u8
, every other value results in
an error.
impl<T> Deserial for Option<T> where
T: Deserial,
[src]
impl<T> Deserial for Option<T> where
T: Deserial,
[src]Deserial by reading one byte, where 0u8
represents None
and 1u8
represents Some
, every other value results in an error.
In the case of Some
we deserialize using the contained T
.
Implementors
impl Deserial for SizeLength
[src]
impl Deserial for SizeLength
[src]pub fn deserial<R>(source: &mut R) -> Result<SizeLength, ParseError> where
R: Read,
[src]
R: Read,
impl Deserial for AccountAddress
[src]
impl Deserial for AccountAddress
[src]pub fn deserial<R>(source: &mut R) -> Result<AccountAddress, ParseError> where
R: Read,
[src]
R: Read,
impl Deserial for AttributeTag
[src]
impl Deserial for AttributeTag
[src]pub fn deserial<R>(source: &mut R) -> Result<AttributeTag, ParseError> where
R: Read,
[src]
R: Read,
impl Deserial for ChainMetadata
[src]
impl Deserial for ChainMetadata
[src]pub fn deserial<R>(source: &mut R) -> Result<ChainMetadata, ParseError> where
R: Read,
[src]
R: Read,
impl Deserial for ContractAddress
[src]
impl Deserial for ContractAddress
[src]pub fn deserial<R>(source: &mut R) -> Result<ContractAddress, ParseError> where
R: Read,
[src]
R: Read,
impl Deserial for OwnedContractName
[src]
impl Deserial for OwnedContractName
[src]pub fn deserial<R>(source: &mut R) -> Result<OwnedContractName, ParseError> where
R: Read,
[src]
R: Read,
impl Deserial for OwnedReceiveName
[src]
impl Deserial for OwnedReceiveName
[src]pub fn deserial<R>(source: &mut R) -> Result<OwnedReceiveName, ParseError> where
R: Read,
[src]
R: Read,
impl Deserial for String
[src]
impl Deserial for String
[src]Deserial by reading an u32
representing the number of bytes, then takes
that number of bytes and tries to decode using utf8.
impl<C> Deserial for PhantomData<C> where
C: ?Sized,
[src]
impl<C> Deserial for PhantomData<C> where
C: ?Sized,
[src]pub fn deserial<R>(_source: &mut R) -> Result<PhantomData<C>, ParseError> where
R: Read,
[src]
R: Read,
impl<K> Deserial for BTreeSet<K> where
K: Deserial + Ord,
[src]
impl<K> Deserial for BTreeSet<K> where
K: Deserial + Ord,
[src]The deserialization of sets assumes their size as a u32.
WARNING: Deserialization does not ensure
the ordering of the keys, it only ensures that there are no duplicates.
Serializing a BTreeSet
via its Serial
instance will lay out elements
by the increasing order. As a consequence deserializing, and
serializing back is in general not the identity. This could have
consequences if the data is hashed, or the byte representation
is used in some other way directly. In those cases the a canonical
order should be ensured to avoid subtle, difficult to diagnose,
bugs.
impl<K, V> Deserial for BTreeMap<K, V> where
K: Deserial + Ord,
V: Deserial,
[src]
impl<K, V> Deserial for BTreeMap<K, V> where
K: Deserial + Ord,
V: Deserial,
[src]The deserialization of maps assumes their size as a u32.
WARNING: Deserialization does not ensure
the ordering of the keys, it only ensures that there are no duplicates.
Serializing a BTreeMap
via its Serial
instance will lay out elements
by the increasing order of keys. As a consequence deserializing, and
serializing back is in general not the identity. This could have
consequences if the data is hashed, or the byte representation
is used in some other way directly. In those cases the a canonical
order should be ensured to avoid subtle, difficult to diagnose,
bugs.