Trait concordium_std::Deserial
source · pub trait Deserial: Sized {
// Required method
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-sources (Read
).
Can be derived using #[derive(Deserial)]
for most cases.
Required Methods§
Object Safety§
Implementations on Foreign Types§
source§impl Deserial for bool
impl Deserial for bool
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.
source§impl<A, B, C, D> Deserial for (A, B, C, D)
impl<A, B, C, D> Deserial for (A, B, C, D)
fn deserial<R>(source: &mut R) -> Result<(A, B, C, D), ParseError>where
R: Read,
source§impl<A, B, C, D, E> Deserial for (A, B, C, D, E)
impl<A, B, C, D, E> Deserial for (A, B, C, D, E)
fn deserial<R>(source: &mut R) -> Result<(A, B, C, D, E), ParseError>where
R: Read,
source§impl<A, B, C, D, E, F> Deserial for (A, B, C, D, E, F)
impl<A, B, C, D, E, F> Deserial for (A, B, C, D, E, F)
fn deserial<R>(source: &mut R) -> Result<(A, B, C, D, E, F), ParseError>where
R: Read,
source§impl<K> Deserial for HashSet<K, BuildHasherDefault<FnvHasher>>
impl<K> Deserial for HashSet<K, BuildHasherDefault<FnvHasher>>
The deserialization of sets assumes their size is a u32.
WARNING: Deserialization only ensures that
there are no duplicates. Serializing a HashSet
via its Serial
instance
will not lay out elements in any particular 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 use a BTreeSet
instead.
fn deserial<R>(
source: &mut R
) -> Result<HashSet<K, BuildHasherDefault<FnvHasher>>, ParseError>where
R: Read,
source§impl<K, V> Deserial for HashMap<K, V, BuildHasherDefault<FnvHasher>>
impl<K, V> Deserial for HashMap<K, V, BuildHasherDefault<FnvHasher>>
The deserialization of maps assumes their size is a u32.
WARNING: Deserialization only ensures that
there are no duplicates. Serializing a HashMap
via its Serial
instance
will not lay out elements in a particular 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 use a BTreeMap
instead.
fn deserial<R>(
source: &mut R
) -> Result<HashMap<K, V, BuildHasherDefault<FnvHasher>>, ParseError>where
R: Read,
source§impl<T> Deserial for Option<T>where
T: Deserial,
impl<T> Deserial for Option<T>where
T: Deserial,
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 Address
impl Deserial for PublicKey
impl Deserial for Signature
impl Deserial for Fields
impl Deserial for FunctionV1
impl Deserial for SizeLength
impl Deserial for Type
impl Deserial for VersionedModuleSchema
impl Deserial for ContractV0
impl Deserial for ContractV1
impl Deserial for ContractV2
impl Deserial for ContractV3
impl Deserial for FunctionV2
impl Deserial for ModuleV0
impl Deserial for ModuleV1
impl Deserial for ModuleV2
impl Deserial for ModuleV3
impl Deserial for AccountAddress
impl Deserial for AccountBalance
impl Deserial for AccountPublicKeys
impl Deserial for AccountSignatures
impl Deserial for Amount
impl Deserial for AttributeTag
impl Deserial for AttributeValue
impl Deserial for ChainMetadata
impl Deserial for ContractAddress
impl Deserial for CredentialPublicKeys
impl Deserial for CredentialSignatures
impl Deserial for Duration
impl Deserial for ExchangeRate
impl Deserial for ExchangeRates
impl Deserial for HashKeccak256
impl Deserial for HashSha2256
impl Deserial for HashSha3256
impl Deserial for MetadataUrl
impl Deserial for OwnedContractName
impl Deserial for OwnedEntrypointName
impl Deserial for OwnedParameter
impl Deserial for OwnedReceiveName
impl Deserial for Policy<Vec<(AttributeTag, AttributeValue)>>
impl Deserial for PublicKeyEcdsaSecp256k1
impl Deserial for PublicKeyEd25519
impl Deserial for SignatureEcdsaSecp256k1
impl Deserial for SignatureEd25519
impl Deserial for String
Deserial by reading an u32
representing the number of bytes, then takes
that number of bytes and tries to decode using utf8.
impl Deserial for Timestamp
impl<C> Deserial for PhantomData<C>where
C: ?Sized,
impl<K> Deserial for BTreeSet<K>
The deserialization of sets assumes their size is 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 a canonical
order should be ensured to avoid subtle, difficult to diagnose,
bugs.
impl<K, V> Deserial for BTreeMap<K, V>
The deserialization of maps assumes their size is 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.
impl<Kind> Deserial for NonZeroThresholdU8<Kind>
impl<Purpose> Deserial for HashBytes<Purpose>
impl<T> Deserial for Box<T>where
T: Deserial,
impl<T> Deserial for Vec<T>where
T: Deserial,
Deserialized by reading an u32
representing the number of elements, then
deserializing that many elements of type T
.