Struct multiversx_sc::types::ManagedBuffer
source · #[repr(transparent)]pub struct ManagedBuffer<M: ManagedTypeApi> { /* private fields */ }
Expand description
A byte buffer managed by an external API.
Implementations§
source§impl<M: ManagedTypeApi> ManagedBuffer<M>
impl<M: ManagedTypeApi> ManagedBuffer<M>
pub fn new() -> Self
pub fn new_from_bytes(bytes: &[u8]) -> Self
pub fn new_random(nr_bytes: usize) -> Self
pub fn with_buffer_contents<R, F>(&self, f: F) -> Rwhere M: ManagedTypeApi, F: FnOnce(&[u8]) -> R,
pub fn with_buffer_contents_mut<F>(&mut self, f: F)where M: ManagedTypeApi, F: FnOnce(&mut [u8]) -> &[u8],
source§impl<M: ManagedTypeApi> ManagedBuffer<M>
impl<M: ManagedTypeApi> ManagedBuffer<M>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn to_boxed_bytes(&self) -> BoxedBytes
sourcepub fn load_slice(
&self,
starting_position: usize,
dest_slice: &mut [u8]
) -> Result<(), InvalidSliceError>
pub fn load_slice( &self, starting_position: usize, dest_slice: &mut [u8] ) -> Result<(), InvalidSliceError>
TODO: investigate the impact of using Result<(), ()>
on the wasm output.
pub fn copy_slice( &self, starting_position: usize, slice_len: usize ) -> Option<ManagedBuffer<M>>
pub fn load_to_byte_array<'a, const N: usize>( &self, array: &'a mut [u8; N] ) -> &'a [u8]
sourcepub fn for_each_batch<const BATCH_SIZE: usize, F: FnMut(&[u8])>(&self, f: F)
pub fn for_each_batch<const BATCH_SIZE: usize, F: FnMut(&[u8])>(&self, f: F)
Loads all bytes of the managed buffer in batches, then applies given closure on each batch.
pub fn overwrite(&mut self, value: &[u8])
pub fn set_slice( &mut self, starting_position: usize, source_slice: &[u8] ) -> Result<(), InvalidSliceError>
pub fn set_random(&mut self, nr_bytes: usize)
pub fn append(&mut self, other: &ManagedBuffer<M>)
pub fn append_bytes(&mut self, slice: &[u8])
sourcepub fn append_u32_be(&mut self, item: u32)
pub fn append_u32_be(&mut self, item: u32)
Utility function: helps serialize lengths (or any other value of type usize) easier.
sourcepub fn concat(self, other: ManagedBuffer<M>) -> Self
pub fn concat(self, other: ManagedBuffer<M>) -> Self
Concatenates 2 managed buffers. Consumes both arguments in the process.
sourcepub fn parse_as_u64(&self) -> Option<u64>
pub fn parse_as_u64(&self) -> Option<u64>
Convenience method for quickly getting a top-decoded u64 from the managed buffer.
TODO: remove this method once TopDecodeInput is implemented for ManagedBuffer reference.
Trait Implementations§
source§impl<M: ManagedTypeApi> Clone for ManagedBuffer<M>
impl<M: ManagedTypeApi> Clone for ManagedBuffer<M>
source§impl<M: ManagedTypeApi> Debug for ManagedBuffer<M>
impl<M: ManagedTypeApi> Debug for ManagedBuffer<M>
source§impl<M: ManagedTypeApi> Default for ManagedBuffer<M>
impl<M: ManagedTypeApi> Default for ManagedBuffer<M>
source§impl<M> From<&[u8]> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> From<&[u8]> for ManagedBuffer<M>where M: ManagedTypeApi,
source§impl<M, const N: usize> From<&[u8; N]> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M, const N: usize> From<&[u8; N]> for ManagedBuffer<M>where M: ManagedTypeApi,
Syntactic sugar only.
source§impl<M: ManagedTypeApi> From<&ManagedBuffer<M>> for BigInt<M>
impl<M: ManagedTypeApi> From<&ManagedBuffer<M>> for BigInt<M>
source§fn from(item: &ManagedBuffer<M>) -> Self
fn from(item: &ManagedBuffer<M>) -> Self
Converts to this type from the input type.
source§impl<M: ManagedTypeApi> From<&ManagedBuffer<M>> for BigUint<M>
impl<M: ManagedTypeApi> From<&ManagedBuffer<M>> for BigUint<M>
source§fn from(item: &ManagedBuffer<M>) -> Self
fn from(item: &ManagedBuffer<M>) -> Self
Converts to this type from the input type.
source§impl<M> From<&str> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> From<&str> for ManagedBuffer<M>where M: ManagedTypeApi,
source§impl<M> From<BoxedBytes> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> From<BoxedBytes> for ManagedBuffer<M>where M: ManagedTypeApi,
source§fn from(bytes: BoxedBytes) -> Self
fn from(bytes: BoxedBytes) -> Self
Converts to this type from the input type.
source§impl<M> From<Empty> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> From<Empty> for ManagedBuffer<M>where M: ManagedTypeApi,
source§impl<M: ManagedTypeApi> From<ManagedBuffer<M>> for BigInt<M>
impl<M: ManagedTypeApi> From<ManagedBuffer<M>> for BigInt<M>
source§fn from(item: ManagedBuffer<M>) -> Self
fn from(item: ManagedBuffer<M>) -> Self
Converts to this type from the input type.
source§impl<M: ManagedTypeApi> From<ManagedBuffer<M>> for BigUint<M>
impl<M: ManagedTypeApi> From<ManagedBuffer<M>> for BigUint<M>
source§fn from(item: ManagedBuffer<M>) -> Self
fn from(item: ManagedBuffer<M>) -> Self
Converts to this type from the input type.
source§impl<M> From<ManagedBuffer<M>> for ManagedSCError<M>where
M: ManagedTypeApi + ErrorApi,
impl<M> From<ManagedBuffer<M>> for ManagedSCError<M>where M: ManagedTypeApi + ErrorApi,
source§fn from(message: ManagedBuffer<M>) -> Self
fn from(message: ManagedBuffer<M>) -> Self
Converts to this type from the input type.
source§impl<M: ManagedTypeApi> From<ManagedBuffer<M>> for StorageKey<M>
impl<M: ManagedTypeApi> From<ManagedBuffer<M>> for StorageKey<M>
source§fn from(buffer: ManagedBuffer<M>) -> Self
fn from(buffer: ManagedBuffer<M>) -> Self
Converts to this type from the input type.
source§impl<M: ManagedTypeApi> From<ManagedBuffer<M>> for TokenIdentifier<M>
impl<M: ManagedTypeApi> From<ManagedBuffer<M>> for TokenIdentifier<M>
source§fn from(buffer: ManagedBuffer<M>) -> Self
fn from(buffer: ManagedBuffer<M>) -> Self
Converts to this type from the input type.
source§impl<M> From<Vec<u8, Global>> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> From<Vec<u8, Global>> for ManagedBuffer<M>where M: ManagedTypeApi,
source§impl<M: ManagedTypeApi> ManagedType<M> for ManagedBuffer<M>
impl<M: ManagedTypeApi> ManagedType<M> for ManagedBuffer<M>
type OwnHandle = <M as HandleTypeInfo>::ManagedBufferHandle
fn get_handle(&self) -> M::ManagedBufferHandle
source§fn transmute_from_handle_ref(handle_ref: &M::ManagedBufferHandle) -> &Self
fn transmute_from_handle_ref(handle_ref: &M::ManagedBufferHandle) -> &Self
Implement carefully, since the underlying transmutation is an unsafe operation.
For types that wrap a handle to some VM-managed data,
make sure the type only contains the handle (plus ZSTs if necessary).
For types that just wrap another managed type it is easier, call for the wrapped object.
fn get_raw_handle(&self) -> RawHandle
fn as_ref(&self) -> ManagedRef<'_, M, Self>
source§impl<M: ManagedTypeApi> ManagedVecItem for ManagedBuffer<M>
impl<M: ManagedTypeApi> ManagedVecItem for ManagedBuffer<M>
source§const PAYLOAD_SIZE: usize = 4usize
const PAYLOAD_SIZE: usize = 4usize
Size of the data stored in the underlying
ManagedBuffer
.source§const SKIPS_RESERIALIZATION: bool = false
const SKIPS_RESERIALIZATION: bool = false
If true, then the encoding of the item is identical to the payload,
and no further conversion is necessary
(the underlying buffer can be used as-is during serialization).
False for all managed types, but true for basic types (like
u32
).§type Ref<'a> = ManagedRef<'a, M, ManagedBuffer<M>>
type Ref<'a> = ManagedRef<'a, M, ManagedBuffer<M>>
Reference representation of the ManagedVec item. Read more
source§fn from_byte_reader<Reader: FnMut(&mut [u8])>(reader: Reader) -> Self
fn from_byte_reader<Reader: FnMut(&mut [u8])>(reader: Reader) -> Self
Parses given bytes as a an owned object.
source§unsafe fn from_byte_reader_as_borrow<'a, Reader: FnMut(&mut [u8])>(
reader: Reader
) -> Self::Ref<'a>
unsafe fn from_byte_reader_as_borrow<'a, Reader: FnMut(&mut [u8])>( reader: Reader ) -> Self::Ref<'a>
Parses given bytes as a representation of the object, either owned, or a reference. Read more
fn to_byte_writer<R, Writer: FnMut(&[u8]) -> R>(&self, writer: Writer) -> R
source§impl<M: ManagedTypeApi> NestedDecode for ManagedBuffer<M>
impl<M: ManagedTypeApi> NestedDecode for ManagedBuffer<M>
source§fn dep_decode_or_handle_err<I, H>(
input: &mut I,
h: H
) -> Result<Self, H::HandledErr>where
I: NestedDecodeInput,
H: DecodeErrorHandler,
fn dep_decode_or_handle_err<I, H>( input: &mut I, h: H ) -> Result<Self, H::HandledErr>where I: NestedDecodeInput, H: DecodeErrorHandler,
Version of
dep_decode
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 dep_decode<I>(input: &mut I) -> Result<Self, DecodeError>where
I: NestedDecodeInput,
fn dep_decode<I>(input: &mut I) -> Result<Self, DecodeError>where I: NestedDecodeInput,
Attempt to deserialise the value from input,
using the format of an object nested inside another structure.
In case of success returns the deserialized value and the number of bytes consumed during the operation.
source§impl<M: ManagedTypeApi> NestedEncode for ManagedBuffer<M>
impl<M: ManagedTypeApi> NestedEncode for ManagedBuffer<M>
source§fn dep_encode_or_handle_err<O, H>(
&self,
dest: &mut O,
h: H
) -> Result<(), H::HandledErr>where
O: NestedEncodeOutput,
H: EncodeErrorHandler,
fn dep_encode_or_handle_err<O, H>( &self, dest: &mut O, h: H ) -> Result<(), H::HandledErr>where O: NestedEncodeOutput, H: EncodeErrorHandler,
Version of
dep_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 dep_encode<O>(&self, dest: &mut O) -> Result<(), EncodeError>where
O: NestedEncodeOutput,
fn dep_encode<O>(&self, dest: &mut O) -> Result<(), EncodeError>where O: NestedEncodeOutput,
NestedEncode to output, using the format of an object nested inside another structure.
Does not provide compact version.
source§impl<M: ManagedTypeApi> NestedEncodeOutput for ManagedBuffer<M>
impl<M: ManagedTypeApi> NestedEncodeOutput for ManagedBuffer<M>
fn supports_specialized_type<T: TryStaticCast>() -> bool
fn push_specialized<T, C, H>( &mut self, _context: C, value: &T, h: H ) -> Result<(), H::HandledErr>where T: TryStaticCast, C: TryStaticCast, H: EncodeErrorHandler,
source§impl<M: ManagedTypeApi, const N: usize> PartialEq<&[u8; N]> for ManagedBuffer<M>
impl<M: ManagedTypeApi, const N: usize> PartialEq<&[u8; N]> for ManagedBuffer<M>
source§impl<M: ManagedTypeApi> PartialEq<[u8]> for ManagedBuffer<M>
impl<M: ManagedTypeApi> PartialEq<[u8]> for ManagedBuffer<M>
source§impl<M: ManagedTypeApi> PartialEq<ManagedBuffer<M>> for ManagedBuffer<M>
impl<M: ManagedTypeApi> PartialEq<ManagedBuffer<M>> for ManagedBuffer<M>
source§impl<M: ManagedTypeApi> SCBinary for ManagedBuffer<M>
impl<M: ManagedTypeApi> SCBinary for ManagedBuffer<M>
fn fmt<F: FormatByteReceiver>(&self, f: &mut F)
source§impl<M: ManagedTypeApi> SCDisplay for ManagedBuffer<M>
impl<M: ManagedTypeApi> SCDisplay for ManagedBuffer<M>
fn fmt<F: FormatByteReceiver>(&self, f: &mut F)
source§impl<M: ManagedTypeApi> SCLowerHex for ManagedBuffer<M>
impl<M: ManagedTypeApi> SCLowerHex for ManagedBuffer<M>
fn fmt<F: FormatByteReceiver>(&self, f: &mut F)
source§impl<M: ManagedTypeApi> TopDecode for ManagedBuffer<M>
impl<M: ManagedTypeApi> TopDecode for ManagedBuffer<M>
source§fn top_decode_or_handle_err<I, H>(input: I, h: H) -> Result<Self, H::HandledErr>where
I: TopDecodeInput,
H: DecodeErrorHandler,
fn top_decode_or_handle_err<I, H>(input: I, h: H) -> Result<Self, H::HandledErr>where I: TopDecodeInput, H: DecodeErrorHandler,
Version of
top_decode
that can handle errors as soon as they occur.
For instance it 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 top_decode<I>(input: I) -> Result<Self, DecodeError>where
I: TopDecodeInput,
fn top_decode<I>(input: I) -> Result<Self, DecodeError>where I: TopDecodeInput,
Attempt to deserialize the value from input.
source§impl<M> TopDecodeInput for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> TopDecodeInput for ManagedBuffer<M>where M: ManagedTypeApi,
type NestedBuffer = ManagedBufferNestedDecodeInput<M>
source§fn into_boxed_slice_u8(self) -> Box<[u8]>
fn into_boxed_slice_u8(self) -> Box<[u8]>
Provides the underlying data as an owned byte slice box.
Consumes the input object in the process.
source§fn into_max_size_buffer<H, const MAX_LEN: usize>(
self,
buffer: &mut [u8; MAX_LEN],
h: H
) -> Result<&[u8], H::HandledErr>where
H: DecodeErrorHandler,
fn into_max_size_buffer<H, const MAX_LEN: usize>( self, buffer: &mut [u8; MAX_LEN], h: H ) -> Result<&[u8], H::HandledErr>where H: DecodeErrorHandler,
Puts the underlying data into a fixed size byte buffer
and returns the populated data slice from this buffer. Read more
fn supports_specialized_type<T: TryStaticCast>() -> bool
fn into_specialized<T, H>(self, h: H) -> Result<T, H::HandledErr>where T: TryStaticCast, H: DecodeErrorHandler,
fn into_nested_buffer(self) -> Self::NestedBuffer
source§fn into_u64<H>(self, h: H) -> Result<u64, <H as DecodeErrorHandler>::HandledErr>where
H: DecodeErrorHandler,
fn into_u64<H>(self, h: H) -> Result<u64, <H as DecodeErrorHandler>::HandledErr>where H: DecodeErrorHandler,
Retrieves the underlying data as a pre-parsed u64.
Expected to panic if the conversion is not possible. Read more
source§fn into_i64<H>(self, h: H) -> Result<i64, <H as DecodeErrorHandler>::HandledErr>where
H: DecodeErrorHandler,
fn into_i64<H>(self, h: H) -> Result<i64, <H as DecodeErrorHandler>::HandledErr>where H: DecodeErrorHandler,
Retrieves the underlying data as a pre-parsed i64.
Expected to panic if the conversion is not possible. Read more
source§impl<M: ManagedTypeApi> TopEncode for ManagedBuffer<M>
impl<M: ManagedTypeApi> TopEncode for ManagedBuffer<M>
source§fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H
) -> Result<(), H::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
fn top_encode_or_handle_err<O, H>( &self, output: O, h: H ) -> Result<(), H::HandledErr>where O: TopEncodeOutput, 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 top_encode<O>(&self, output: O) -> Result<(), EncodeError>where
O: TopEncodeOutput,
fn top_encode<O>(&self, output: O) -> Result<(), EncodeError>where O: TopEncodeOutput,
Attempt to serialize the value to ouput.
source§impl<M: ManagedTypeApi> TopEncodeOutput for &mut ManagedBuffer<M>
impl<M: ManagedTypeApi> TopEncodeOutput for &mut ManagedBuffer<M>
§type NestedBuffer = ManagedBuffer<M>
type NestedBuffer = ManagedBuffer<M>
Type of
NestedEncodeOutput
that can be spawned to gather serializations of children.fn set_slice_u8(self, bytes: &[u8])
fn supports_specialized_type<T: TryStaticCast>() -> bool
source§fn set_specialized<T, H>(self, value: &T, h: H) -> Result<(), H::HandledErr>where
T: TryStaticCast,
H: EncodeErrorHandler,
fn set_specialized<T, H>(self, value: &T, h: H) -> Result<(), H::HandledErr>where T: TryStaticCast, H: EncodeErrorHandler,
Allows special handling of special types.
Also requires an alternative serialization, in case the special handling is not covered.
The alternative serialization,
else_serialization
is only called when necessary and
is normally compiled out via monomorphization.fn start_nested_encode(&self) -> Self::NestedBuffer
fn finalize_nested_encode(self, nb: Self::NestedBuffer)
fn set_u64(self, value: u64)
fn set_i64(self, value: i64)
source§impl<M> TryFrom<ManagedBuffer<M>> for ManagedAddress<M>where
M: ManagedTypeApi,
impl<M> TryFrom<ManagedBuffer<M>> for ManagedAddress<M>where M: ManagedTypeApi,
§type Error = DecodeError
type Error = DecodeError
The type returned in the event of a conversion error.
source§impl<M, const N: usize> TryFrom<ManagedBuffer<M>> for ManagedByteArray<M, N>where
M: ManagedTypeApi,
impl<M, const N: usize> TryFrom<ManagedBuffer<M>> for ManagedByteArray<M, N>where M: ManagedTypeApi,
§type Error = DecodeError
type Error = DecodeError
The type returned in the event of a conversion error.
source§impl<M: ManagedTypeApi> TryStaticCast for ManagedBuffer<M>
impl<M: ManagedTypeApi> TryStaticCast for ManagedBuffer<M>
fn type_eq<U>() -> boolwhere U: TryStaticCast,
fn try_cast<U>(self) -> Option<U>where U: TryStaticCast,
fn try_cast_ref<U>(&self) -> Option<&U>where U: TryStaticCast,
source§impl<M: ManagedTypeApi> TypeAbi for ManagedBuffer<M>
impl<M: ManagedTypeApi> TypeAbi for ManagedBuffer<M>
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<M> CodecFrom<&[u8]> for ManagedBuffer<M>where M: ManagedTypeApi,
impl<M, const N: usize> CodecFrom<&[u8; N]> for ManagedBuffer<M>where M: ManagedTypeApi,
impl<M: ManagedTypeApi> CodecFrom<&BoxedBytes> for ManagedBuffer<M>
impl<M: ManagedTypeApi> CodecFrom<&ManagedBuffer<M>> for BoxedBytes
impl<M: ManagedTypeApi> CodecFrom<&ManagedBuffer<M>> for String
impl<M: ManagedTypeApi> CodecFrom<&ManagedBuffer<M>> for Vec<u8>
impl<M: ManagedTypeApi> CodecFrom<&String> for ManagedBuffer<M>
impl<M: ManagedTypeApi> CodecFrom<&Vec<u8, Global>> for ManagedBuffer<M>
impl<M> CodecFrom<&str> for ManagedBuffer<M>where M: ManagedTypeApi,
impl<M: ManagedTypeApi> CodecFrom<BoxedBytes> for ManagedBuffer<M>
impl<M: ManagedTypeApi> CodecFrom<ManagedBuffer<M>> for BoxedBytes
impl<M: ManagedTypeApi> CodecFrom<ManagedBuffer<M>> for String
impl<M: ManagedTypeApi> CodecFrom<ManagedBuffer<M>> for Vec<u8>
impl<M: ManagedTypeApi> CodecFrom<OperationCompletionStatus> for ManagedBuffer<M>
impl<M: ManagedTypeApi> CodecFrom<String> for ManagedBuffer<M>
impl<M: ManagedTypeApi> CodecFrom<Vec<u8, Global>> for ManagedBuffer<M>
impl<M> CodecFromSelf for ManagedBuffer<M>where M: ManagedTypeApi,
impl<M: ManagedTypeApi> Eq for ManagedBuffer<M>
Auto Trait Implementations§
impl<M> RefUnwindSafe for ManagedBuffer<M>where <M as HandleTypeInfo>::ManagedBufferHandle: RefUnwindSafe,
impl<M> Send for ManagedBuffer<M>where <M as HandleTypeInfo>::ManagedBufferHandle: Send,
impl<M> Sync for ManagedBuffer<M>where <M as HandleTypeInfo>::ManagedBufferHandle: Sync,
impl<M> Unpin for ManagedBuffer<M>where <M as HandleTypeInfo>::ManagedBufferHandle: Unpin,
impl<M> UnwindSafe for ManagedBuffer<M>where <M as HandleTypeInfo>::ManagedBufferHandle: UnwindSafe,
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
source§impl<T> SCCodec for Twhere
T: TopEncode,
impl<T> SCCodec for Twhere T: TopEncode,
fn fmt<F>(&self, f: &mut F)where F: FormatByteReceiver,
source§impl<T> TopDecodeMulti for Twhere
T: TopDecode,
impl<T> TopDecodeMulti for Twhere T: TopDecode,
source§const IS_SINGLE_VALUE: bool = true
const IS_SINGLE_VALUE: bool = true
Used to optimize single value loading of endpoint arguments.
fn multi_decode_or_handle_err<I, H>( input: &mut I, h: H ) -> Result<T, <H as DecodeErrorHandler>::HandledErr>where I: TopDecodeMultiInput, H: DecodeErrorHandler,
fn multi_decode<I>(input: &mut I) -> Result<Self, DecodeError>where I: TopDecodeMultiInput,
source§impl<T> TopDecodeMultiLength for Twhere
T: TopEncode + TopDecode,
impl<T> TopDecodeMultiLength for Twhere T: TopEncode + TopDecode,
source§impl<T> TopEncodeMulti for Twhere
T: TopEncode,
impl<T> TopEncodeMulti for Twhere T: TopEncode,
source§fn multi_encode_or_handle_err<O, H>(
&self,
output: &mut O,
h: H
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeMultiOutput,
H: EncodeErrorHandler,
fn multi_encode_or_handle_err<O, H>( &self, output: &mut O, h: H ) -> Result<(), <H as EncodeErrorHandler>::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.