Trait concordium_std::Serial
source · pub trait Serial {
// Required method
fn serial<W>(&self, _out: &mut W) -> Result<(), <W as Write>::Err>
where W: Write;
}
Expand description
The Serial
trait provides a means of writing structures into byte-sinks
(Write
).
Can be derived using #[derive(Serial)]
for most cases.
Required Methods§
Object Safety§
Implementations on Foreign Types§
source§impl Serial for &str
impl Serial for &str
Serialized by writing an u32
representing the number of bytes for a
utf8-encoding of the string, then writing the bytes. Similar to Vec<_>
.
source§impl Serial for bool
impl Serial for bool
Serialization of bool
encodes it as a single byte, false
is represented
by 0u8
and true
is only represented by 1u8
.
source§impl<A, B, C, D> Serial for (A, B, C, D)
impl<A, B, C, D> Serial for (A, B, C, D)
source§impl<A, B, C, D, E> Serial for (A, B, C, D, E)
impl<A, B, C, D, E> Serial for (A, B, C, D, E)
source§impl<A, B, C, D, E, F> Serial for (A, B, C, D, E, F)
impl<A, B, C, D, E, F> Serial for (A, B, C, D, E, F)
source§impl<K> Serial for HashSet<K, BuildHasherDefault<FnvHasher>>where
K: Serial,
impl<K> Serial for HashSet<K, BuildHasherDefault<FnvHasher>>where
K: Serial,
sufficient for all realistic use cases in smart contracts. They are serialized in no particular order.
source§impl<K, V> Serial for HashMap<K, V, BuildHasherDefault<FnvHasher>>
impl<K, V> Serial for HashMap<K, V, BuildHasherDefault<FnvHasher>>
The serialization of maps encodes their size as a u32. This should be sufficient for all realistic use cases in smart contracts. They are serialized in no particular order.
source§impl<T> Serial for Option<T>where
T: Serial,
impl<T> Serial for Option<T>where
T: Serial,
Serialized if the Option
is a None
we write 0u8
. If Some
, we write
1u8
followed by the serialization of the contained T
.
source§impl<T, const N: usize> Serial for [T; N]where
T: Serial,
impl<T, const N: usize> Serial for [T; N]where
T: Serial,
Serialize the array by writing elements consecutively starting at 0. Since the length of the array is known statically it is not written out explicitly. Thus serialization of the array A and the slice &A[..] differ.
Implementors§
impl Serial for Address
impl Serial for PublicKey
impl Serial for Signature
impl Serial for Fields
impl Serial for FunctionV1
impl Serial for SizeLength
impl Serial for Type
impl Serial for VersionedModuleSchema
impl Serial for ContractV0
impl Serial for ContractV1
impl Serial for ContractV2
impl Serial for ContractV3
impl Serial for FunctionV2
impl Serial for ModuleV0
impl Serial for ModuleV1
impl Serial for ModuleV2
impl Serial for ModuleV3
impl Serial for AccountAddress
impl Serial for AccountBalance
impl Serial for AccountPublicKeys
impl Serial for AccountSignatures
impl Serial for Amount
impl Serial for AttributeTag
impl Serial for AttributeValue
impl Serial for ChainMetadata
impl Serial for ContractAddress
impl Serial for CredentialPublicKeys
impl Serial for CredentialSignatures
impl Serial for Duration
impl Serial for ExchangeRate
impl Serial for ExchangeRates
impl Serial for HashKeccak256
impl Serial for HashSha2256
impl Serial for HashSha3256
impl Serial for MetadataUrl
impl Serial for OwnedContractName
impl Serial for OwnedEntrypointName
impl Serial for OwnedParameter
impl Serial for OwnedReceiveName
impl Serial for Policy<Vec<(AttributeTag, AttributeValue)>>
impl Serial for PublicKeyEcdsaSecp256k1
impl Serial for PublicKeyEd25519
impl Serial for SignatureEcdsaSecp256k1
impl Serial for SignatureEd25519
impl Serial for String
Serialized by writing an u32
representing the number of bytes for a
utf8-encoding of the string, then writing the bytes. Similar to &str
.
impl Serial for Timestamp
impl<'a> Serial for ContractName<'a>
impl<'a> Serial for EntrypointName<'a>
impl<'a> Serial for Parameter<'a>
impl<'a> Serial for ReceiveName<'a>
impl<C> Serial for PhantomData<C>where
C: ?Sized,
impl<K> Serial for BTreeSet<K>
The serialization of sets encodes their size as a u32. This should be sufficient for all realistic use cases in smart contracts. They are serialized in canonical order (increasing)
impl<K, V> Serial for BTreeMap<K, V>
The serialization of maps encodes their size as a u32. This should be sufficient for all realistic use cases in smart contracts. They are serialized in ascending order.
impl<K, V, S> Serial for StateMap<K, V, S>
impl<Kind> Serial for NonZeroThresholdU8<Kind>
impl<Purpose> Serial for HashBytes<Purpose>
impl<T> Serial for Box<T>where
T: Serial,
impl<T> Serial for Vec<T>where
T: Serial,
Serialized by writing an u32
representing the number of elements, followed
by the elements serialized according to their type T
.