Struct dharitri_wasm::types::MultiValueEncoded
source · pub struct MultiValueEncoded<M, T>where
M: ManagedTypeApi,{ /* private fields */ }Expand description
A multi-value container, that keeps raw values as ManagedBuffer It allows encoding and decoding of multi-values.
Since items are kept raw, the item type does not need to implement ManagedVecItem.
Behavior:
- It is lazy when decoding, in that it keeps them raw and will not decode the values until they are requested.
- It is eager when encoding, items are serialized before being added to this structure.
Since it can contain multi-values, the number of actual items it contains cannot be determined without fully decoding.
Implementations§
source§impl<M, T> MultiValueEncoded<M, T>where
M: ManagedTypeApi,
impl<M, T> MultiValueEncoded<M, T>where
M: ManagedTypeApi,
source§impl<M, T> MultiValueEncoded<M, T>
impl<M, T> MultiValueEncoded<M, T>
source§impl<M, T> MultiValueEncoded<M, T>where
M: ManagedTypeApi,
impl<M, T> MultiValueEncoded<M, T>where
M: ManagedTypeApi,
pub fn to_arg_buffer(&self) -> ManagedArgBuffer<M>
source§impl<M> MultiValueEncoded<M, ManagedBuffer<M>>where
M: ManagedTypeApi,
impl<M> MultiValueEncoded<M, ManagedBuffer<M>>where
M: ManagedTypeApi,
pub fn into_vec_of_buffers(self) -> ManagedVec<M, ManagedBuffer<M>>
source§impl<M, T> MultiValueEncoded<M, T>where
M: ManagedTypeApi + ErrorApi,
impl<M, T> MultiValueEncoded<M, T>where
M: ManagedTypeApi + ErrorApi,
source§impl<M, T> MultiValueEncoded<M, T>
impl<M, T> MultiValueEncoded<M, T>
source§impl<M, T> MultiValueEncoded<M, T>
impl<M, T> MultiValueEncoded<M, T>
pub fn to_vec(&self) -> ManagedVec<M, T>
Trait Implementations§
source§impl<M, T: Clone> Clone for MultiValueEncoded<M, T>where
M: ManagedTypeApi + Clone,
impl<M, T: Clone> Clone for MultiValueEncoded<M, T>where
M: ManagedTypeApi + Clone,
source§fn clone(&self) -> MultiValueEncoded<M, T>
fn clone(&self) -> MultiValueEncoded<M, T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl<M, T: Default> Default for MultiValueEncoded<M, T>where
M: ManagedTypeApi + Default,
impl<M, T: Default> Default for MultiValueEncoded<M, T>where
M: ManagedTypeApi + Default,
source§fn default() -> MultiValueEncoded<M, T>
fn default() -> MultiValueEncoded<M, T>
Returns the “default value” for a type. Read more
source§impl<M, T> From<&ManagedVec<M, T>> for MultiValueEncoded<M, T>
impl<M, T> From<&ManagedVec<M, T>> for MultiValueEncoded<M, T>
source§fn from(v: &ManagedVec<M, T>) -> Self
fn from(v: &ManagedVec<M, T>) -> Self
Converts to this type from the input type.
source§impl<M, T> From<ManagedVec<M, T>> for MultiValueEncoded<M, T>
impl<M, T> From<ManagedVec<M, T>> for MultiValueEncoded<M, T>
source§fn from(v: ManagedVec<M, T>) -> Self
fn from(v: ManagedVec<M, T>) -> Self
Converts to this type from the input type.
source§impl<M, T> IntoIterator for MultiValueEncoded<M, T>
impl<M, T> IntoIterator for MultiValueEncoded<M, T>
source§impl<M, T> TopDecodeMulti for MultiValueEncoded<M, T>
impl<M, T> TopDecodeMulti for MultiValueEncoded<M, T>
fn multi_decode_or_handle_err<I, H>(
input: &mut I,
h: H
) -> Result<Self, H::HandledErr>where
I: TopDecodeMultiInput,
H: DecodeErrorHandler,
source§const IS_SINGLE_VALUE: bool = false
const IS_SINGLE_VALUE: bool = false
Used to optimize single value loading of endpoint arguments.
fn multi_decode<I>(input: &mut I) -> Result<Self, DecodeError>where
I: TopDecodeMultiInput,
source§impl<M, T> TopEncodeMulti for &MultiValueEncoded<M, T>
impl<M, T> TopEncodeMulti for &MultiValueEncoded<M, T>
source§fn multi_encode_or_handle_err<O, H>(
&self,
output: &mut O,
h: H
) -> Result<(), H::HandledErr>where
O: TopEncodeMultiOutput,
H: EncodeErrorHandler,
fn multi_encode_or_handle_err<O, H>(
&self,
output: &mut O,
h: H
) -> Result<(), H::HandledErr>where
O: TopEncodeMultiOutput,
H: EncodeErrorHandler,
Version of
top_encode that can handle errors as soon as they occur.
For instance in can exit immediately and make sure that if it returns, it is a success.
By not deferring error handling, this can lead to somewhat smaller bytecode.source§fn multi_encode<O>(&self, output: &mut O) -> Result<(), EncodeError>where
O: TopEncodeMultiOutput,
fn multi_encode<O>(&self, output: &mut O) -> Result<(), EncodeError>where
O: TopEncodeMultiOutput,
Attempt to serialize the value to ouput.
source§impl<M, T> TopEncodeMulti for MultiValueEncoded<M, T>
impl<M, T> TopEncodeMulti for MultiValueEncoded<M, T>
source§fn multi_encode_or_handle_err<O, H>(
&self,
output: &mut O,
h: H
) -> Result<(), H::HandledErr>where
O: TopEncodeMultiOutput,
H: EncodeErrorHandler,
fn multi_encode_or_handle_err<O, H>(
&self,
output: &mut O,
h: H
) -> Result<(), H::HandledErr>where
O: TopEncodeMultiOutput,
H: EncodeErrorHandler,
Version of
top_encode that can handle errors as soon as they occur.
For instance in can exit immediately and make sure that if it returns, it is a success.
By not deferring error handling, this can lead to somewhat smaller bytecode.source§fn multi_encode<O>(&self, output: &mut O) -> Result<(), EncodeError>where
O: TopEncodeMultiOutput,
fn multi_encode<O>(&self, output: &mut O) -> Result<(), EncodeError>where
O: TopEncodeMultiOutput,
Attempt to serialize the value to ouput.
source§impl<M, T> TypeAbi for MultiValueEncoded<M, T>where
M: ManagedTypeApi,
T: TypeAbi,
impl<M, T> TypeAbi for MultiValueEncoded<M, T>where
M: ManagedTypeApi,
T: TypeAbi,
fn type_name() -> TypeName
source§fn provide_type_descriptions<TDC: TypeDescriptionContainer>(
accumulator: &mut TDC
)
fn provide_type_descriptions<TDC: TypeDescriptionContainer>( accumulator: &mut TDC )
A type can provide more than its own description.
For instance, a struct can also provide the descriptions of the type of its fields.
TypeAbi doesn’t care for the exact accumulator type,
which is abstracted by the TypeDescriptionContainer trait.
impl<SA, K, V> CodecFrom<BiDiMapper<SA, K, V>> for MultiValueEncoded<SA, MultiValue2<K, V>>where
SA: StorageMapperApi,
K: TopEncode + TopDecode + NestedEncode + NestedDecode + 'static + Default + PartialEq,
V: TopEncode + TopDecode + NestedEncode + NestedDecode + 'static + Default + PartialEq,
impl<SA, T> CodecFrom<LinkedListMapper<SA, T>> for MultiValueEncoded<SA, T>
impl<SA, K, V> CodecFrom<MapMapper<SA, K, V>> for MultiValueEncoded<SA, MultiValue2<K, V>>where
SA: StorageMapperApi,
K: TopEncode + TopDecode + NestedEncode + NestedDecode + 'static,
V: TopEncode + TopDecode + 'static,
impl<SA, T> CodecFrom<QueueMapper<SA, T>> for MultiValueEncoded<SA, T>
impl<SA, T> CodecFrom<SetMapper<SA, T>> for MultiValueEncoded<SA, T>
impl<SA> CodecFrom<UniqueIdMapper<SA>> for MultiValueEncoded<SA, usize>where
SA: StorageMapperApi,
impl<SA, T> CodecFrom<UnorderedSetMapper<SA, T>> for MultiValueEncoded<SA, T>
impl<SA> CodecFrom<UserMapper<SA>> for MultiValueEncoded<SA, ManagedAddress<SA>>where
SA: StorageMapperApi,
impl<SA, T> CodecFrom<VecMapper<SA, T>> for MultiValueEncoded<SA, T>
impl<M, T> CodecFromSelf for MultiValueEncoded<M, T>where
M: ManagedTypeApi,
Auto Trait Implementations§
impl<M, T> RefUnwindSafe for MultiValueEncoded<M, T>
impl<M, T> Send for MultiValueEncoded<M, T>
impl<M, T> Sync for MultiValueEncoded<M, T>
impl<M, T> Unpin for MultiValueEncoded<M, T>
impl<M, T> UnwindSafe for MultiValueEncoded<M, T>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more