Trait concordium_std::Serial
source · [−]pub trait Serial {
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
Implementations on Foreign Types
sourceimpl<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
.
sourceimpl 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
.
sourceimpl<K, V> Serial for HashMap<K, V, BuildHasherDefault<FnvHasher>, Global> where
K: Serial,
V: Serial,
impl<K, V> Serial for HashMap<K, V, BuildHasherDefault<FnvHasher>, Global> where
K: Serial,
V: Serial,
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.
sourceimpl<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.
sourceimpl 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<_>
.
sourceimpl<K> Serial for HashSet<K, BuildHasherDefault<FnvHasher>, Global> where
K: Serial,
impl<K> Serial for HashSet<K, BuildHasherDefault<FnvHasher>, Global> where
K: Serial,
sufficient for all realistic use cases in smart contracts. They are serialized in no particular order.
Implementors
impl Serial for Address
impl Serial for Fields
impl Serial for FunctionV1
impl Serial for FunctionV2
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 ModuleV0
impl Serial for ModuleV1
impl Serial for ModuleV2
impl Serial for AccountAddress
impl Serial for Amount
impl Serial for AttributeTag
impl Serial for AttributeValue
impl Serial for ChainMetadata
impl Serial for ContractAddress
impl Serial for Duration
impl Serial for HashKeccak256
impl Serial for HashSha2256
impl Serial for HashSha3256
impl Serial for OwnedContractName
impl Serial for OwnedEntrypointName
impl Serial for OwnedParameter
impl Serial for OwnedReceiveName
impl Serial for Policy<Vec<(AttributeTag, AttributeValue), Global>>
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, Global> where
K: Serial + Ord,
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, Global> where
K: Serial + Ord,
V: Serial,
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<T> Serial for Box<T, Global> where
T: Serial,
impl<T> Serial for Vec<T, Global> where
T: Serial,
Serialized by writing an u32
representing the number of elements, followed
by the elements serialized according to their type T
.