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: Debug> Debug for MultiValueEncoded<M, T>where
M: ManagedTypeApi + Debug,
impl<M, T: Debug> Debug for MultiValueEncoded<M, T>where
M: ManagedTypeApi + Debug,
Source§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, V> FromIterator<V> for MultiValueEncoded<M, V>where
M: ManagedTypeApi,
V: TopEncodeMulti,
impl<M, V> FromIterator<V> for MultiValueEncoded<M, V>where
M: ManagedTypeApi,
V: TopEncodeMulti,
Source§fn from_iter<T: IntoIterator<Item = V>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = V>>(iter: T) -> Self
Creates a value from an iterator. Read more
Source§impl<M, T> IntoIterator for MultiValueEncoded<M, T>
impl<M, T> IntoIterator for MultiValueEncoded<M, T>
Source§impl<M, T: PartialEq> PartialEq for MultiValueEncoded<M, T>where
M: ManagedTypeApi + PartialEq,
impl<M, T: PartialEq> PartialEq for MultiValueEncoded<M, T>where
M: ManagedTypeApi + PartialEq,
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,
type Unmanaged = MultiValueVec<<T as TypeAbi>::Unmanaged>
fn type_name() -> TypeName
fn type_name_rust() -> 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 name.
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.
fn type_names() -> TypeNames
impl<M, T> StructuralPartialEq for MultiValueEncoded<M, T>where
M: ManagedTypeApi,
impl<M, T> TypeAbiFrom<&MultiValueEncoded<M, T>> for MultiValueEncoded<M, T>where
M: ManagedTypeApi,
T: TypeAbi,
impl<SA, K, V> TypeAbiFrom<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, U> TypeAbiFrom<LinkedListMapper<SA, T>> for MultiValueEncoded<SA, U>where
SA: StorageMapperApi,
T: TopEncode + TopDecode + NestedEncode + NestedDecode + Clone,
U: TypeAbiFrom<T>,
impl<SA, K, V> TypeAbiFrom<MapMapper<SA, K, V>> for MultiValueEncoded<SA, MultiValue2<K, V>>where
SA: StorageMapperApi,
K: TopEncode + TopDecode + NestedEncode + NestedDecode + 'static,
V: TopEncode + TopDecode + 'static,
impl<M, T> TypeAbiFrom<MultiValueEncoded<M, T>> for MultiValueEncoded<M, T>where
M: ManagedTypeApi,
T: TypeAbi,
impl<M, T, U> TypeAbiFrom<MultiValueEncoded<M, T>> for MultiValueVec<U>
impl<M, T, U> TypeAbiFrom<MultiValueVec<T>> for MultiValueEncoded<M, U>
impl<SA, T> TypeAbiFrom<QueueMapper<SA, T>> for MultiValueEncoded<SA, T>
impl<SA, T> TypeAbiFrom<SetMapper<SA, T>> for MultiValueEncoded<SA, T>
impl<SA> TypeAbiFrom<UniqueIdMapper<SA>> for MultiValueEncoded<SA, usize>where
SA: StorageMapperApi,
impl<SA, T> TypeAbiFrom<UnorderedSetMapper<SA, T>> for MultiValueEncoded<SA, T>
impl<SA> TypeAbiFrom<UserMapper<SA>> for MultiValueEncoded<SA, ManagedAddress<SA>>where
SA: StorageMapperApi,
impl<SA, T> TypeAbiFrom<VecMapper<SA, T>> for MultiValueEncoded<SA, T>
Auto Trait Implementations§
impl<M, T> Freeze for MultiValueEncoded<M, T>
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