pub struct ManagedBuffer<M>where
M: ManagedTypeApi,{ /* private fields */ }
Expand description
A byte buffer managed by an external API.
Implementations§
Source§impl<M> ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> ManagedBuffer<M>where
M: ManagedTypeApi,
pub fn new() -> ManagedBuffer<M>
pub fn new_from_bytes(bytes: &[u8]) -> ManagedBuffer<M>
pub fn new_random(nr_bytes: usize) -> ManagedBuffer<M>
Sourcepub unsafe fn new_uninit() -> ManagedBuffer<M>
pub unsafe fn new_uninit() -> ManagedBuffer<M>
Creates a new object, without initializing it.
§Safety
The value needs to be initialized after creation, otherwise the VM will halt the first time the value is attempted to be read.
Sourcepub unsafe fn temp_const_ref(
raw_handle: i32,
) -> ManagedRef<'static, M, ManagedBuffer<M>>
pub unsafe fn temp_const_ref( raw_handle: i32, ) -> ManagedRef<'static, M, ManagedBuffer<M>>
Creates a shared managed reference to a given raw handle.
§Safety
The reference points to a shared value. Make sure the handle is not leaked.
Sourcepub unsafe fn temp_const_ref_mut(
raw_handle: i32,
) -> ManagedRefMut<'static, M, ManagedBuffer<M>>
pub unsafe fn temp_const_ref_mut( raw_handle: i32, ) -> ManagedRefMut<'static, M, ManagedBuffer<M>>
Creates a shared managed reference to a given raw handle.
§Safety
The reference points to a shared value. Make sure the handle is not leaked.
pub fn with_buffer_contents<R, F>(&self, f: F) -> R
pub fn with_buffer_contents_mut<F>(&mut self, f: F)
Source§impl<M> ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> ManagedBuffer<M>where
M: ManagedTypeApi,
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn to_boxed_bytes(&self) -> BoxedBytes
pub fn to_boxed_bytes(&self) -> BoxedBytes
Method provided for convenience in tests, not to be used in contracts.
Sourcepub fn to_vec(&self) -> Vec<u8> ⓘ
pub fn to_vec(&self) -> Vec<u8> ⓘ
Method provided for convenience in tests, not to be used in contracts.
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>(&self, f: F)
pub fn for_each_batch<const BATCH_SIZE: usize, F>(&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>) -> ManagedBuffer<M>
pub fn concat(self, other: ManagedBuffer<M>) -> ManagedBuffer<M>
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.
Sourcepub fn hex_expr(&self) -> ManagedBuffer<M>
pub fn hex_expr(&self) -> ManagedBuffer<M>
Produces a hex expression in another managed buffer, made up of “0x” + the hex representation of the data.
Trait Implementations§
Source§impl<Env> AnnotatedValue<Env, ManagedBuffer<<Env as TxEnv>::Api>> for &BytesValuewhere
Env: TxEnv,
impl<Env> AnnotatedValue<Env, ManagedBuffer<<Env as TxEnv>::Api>> for &BytesValuewhere
Env: TxEnv,
fn annotation(&self, _env: &Env) -> ManagedBuffer<<Env as TxEnv>::Api>
Source§fn to_value(&self, _env: &Env) -> ManagedBuffer<Env::Api>
fn to_value(&self, _env: &Env) -> ManagedBuffer<Env::Api>
.clone()
in some cases.Source§fn into_value(self, env: &Env) -> T
fn into_value(self, env: &Env) -> T
Source§impl<Env> AnnotatedValue<Env, ManagedBuffer<<Env as TxEnv>::Api>> for ()where
Env: TxEnv,
impl<Env> AnnotatedValue<Env, ManagedBuffer<<Env as TxEnv>::Api>> for ()where
Env: TxEnv,
fn annotation(&self, _env: &Env) -> ManagedBuffer<<Env as TxEnv>::Api>
Source§fn to_value(&self, _env: &Env) -> ManagedBuffer<<Env as TxEnv>::Api>
fn to_value(&self, _env: &Env) -> ManagedBuffer<<Env as TxEnv>::Api>
.clone()
in some cases.Source§fn into_value(self, env: &Env) -> T
fn into_value(self, env: &Env) -> T
Source§impl<Env> AnnotatedValue<Env, ManagedBuffer<<Env as TxEnv>::Api>> for BytesValuewhere
Env: TxEnv,
impl<Env> AnnotatedValue<Env, ManagedBuffer<<Env as TxEnv>::Api>> for BytesValuewhere
Env: TxEnv,
fn annotation(&self, _env: &Env) -> ManagedBuffer<<Env as TxEnv>::Api>
Source§fn to_value(&self, _env: &Env) -> ManagedBuffer<Env::Api>
fn to_value(&self, _env: &Env) -> ManagedBuffer<Env::Api>
.clone()
in some cases.Source§fn into_value(self, env: &Env) -> T
fn into_value(self, env: &Env) -> T
Source§impl<Env> AnnotatedValue<Env, ManagedBuffer<<Env as TxEnv>::Api>> for FilePath<'_>where
Env: ScenarioTxEnv,
impl<Env> AnnotatedValue<Env, ManagedBuffer<<Env as TxEnv>::Api>> for FilePath<'_>where
Env: ScenarioTxEnv,
fn annotation(&self, _env: &Env) -> ManagedBuffer<Env::Api>
Source§fn to_value(&self, env: &Env) -> ManagedBuffer<Env::Api>
fn to_value(&self, env: &Env) -> ManagedBuffer<Env::Api>
.clone()
in some cases.Source§fn into_value(self, env: &Env) -> T
fn into_value(self, env: &Env) -> T
Source§impl<Env> AnnotatedValue<Env, ManagedBuffer<<Env as TxEnv>::Api>> for ManagedBuffer<<Env as TxEnv>::Api>where
Env: TxEnv,
impl<Env> AnnotatedValue<Env, ManagedBuffer<<Env as TxEnv>::Api>> for ManagedBuffer<<Env as TxEnv>::Api>where
Env: TxEnv,
fn annotation(&self, _env: &Env) -> ManagedBuffer<<Env as TxEnv>::Api>
Source§fn to_value(&self, _env: &Env) -> ManagedBuffer<<Env as TxEnv>::Api>
fn to_value(&self, _env: &Env) -> ManagedBuffer<<Env as TxEnv>::Api>
.clone()
in some cases.Source§fn into_value(self, _env: &Env) -> ManagedBuffer<<Env as TxEnv>::Api>
fn into_value(self, _env: &Env) -> ManagedBuffer<<Env as TxEnv>::Api>
Source§fn with_value_ref<F, R>(&self, _env: &Env, f: F) -> R
fn with_value_ref<F, R>(&self, _env: &Env, f: F) -> R
Source§impl<Env> AnnotatedValue<Env, ManagedBuffer<<Env as TxEnv>::Api>> for MxscPath<'_>where
Env: ScenarioTxEnv,
impl<Env> AnnotatedValue<Env, ManagedBuffer<<Env as TxEnv>::Api>> for MxscPath<'_>where
Env: ScenarioTxEnv,
fn annotation(&self, _env: &Env) -> ManagedBuffer<Env::Api>
Source§fn to_value(&self, env: &Env) -> ManagedBuffer<Env::Api>
fn to_value(&self, env: &Env) -> ManagedBuffer<Env::Api>
.clone()
in some cases.Source§fn into_value(self, env: &Env) -> T
fn into_value(self, env: &Env) -> T
Source§impl<M> Clone for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> Clone for ManagedBuffer<M>where
M: ManagedTypeApi,
Source§fn clone(&self) -> ManagedBuffer<M>
fn clone(&self) -> ManagedBuffer<M>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<M> Debug for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> Debug for ManagedBuffer<M>where
M: ManagedTypeApi,
Source§impl<M> Default for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> Default for ManagedBuffer<M>where
M: ManagedTypeApi,
Source§fn default() -> ManagedBuffer<M>
fn default() -> ManagedBuffer<M>
Source§impl<M> Display for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> Display for ManagedBuffer<M>where
M: ManagedTypeApi,
Source§impl<M> From<&[u8]> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> From<&[u8]> for ManagedBuffer<M>where
M: ManagedTypeApi,
Source§fn from(bytes: &[u8]) -> ManagedBuffer<M>
fn from(bytes: &[u8]) -> ManagedBuffer<M>
Source§impl<M, const N: usize> From<&[u8; N]> for ManagedBuffer<M>where
M: ManagedTypeApi,
Syntactic sugar only.
impl<M, const N: usize> From<&[u8; N]> for ManagedBuffer<M>where
M: ManagedTypeApi,
Syntactic sugar only.
Source§impl<M> From<&ManagedBuffer<M>> for BigFloat<M>where
M: ManagedTypeApi,
impl<M> From<&ManagedBuffer<M>> for BigFloat<M>where
M: ManagedTypeApi,
Source§fn from(item: &ManagedBuffer<M>) -> BigFloat<M>
fn from(item: &ManagedBuffer<M>) -> BigFloat<M>
Source§impl<M> From<&ManagedBuffer<M>> for BigInt<M>where
M: ManagedTypeApi,
impl<M> From<&ManagedBuffer<M>> for BigInt<M>where
M: ManagedTypeApi,
Source§fn from(item: &ManagedBuffer<M>) -> BigInt<M>
fn from(item: &ManagedBuffer<M>) -> BigInt<M>
Source§impl<M> From<&ManagedBuffer<M>> for BigUint<M>where
M: ManagedTypeApi,
impl<M> From<&ManagedBuffer<M>> for BigUint<M>where
M: ManagedTypeApi,
Source§fn from(item: &ManagedBuffer<M>) -> BigUint<M>
fn from(item: &ManagedBuffer<M>) -> BigUint<M>
Source§impl<M> From<&String> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> From<&String> for ManagedBuffer<M>where
M: ManagedTypeApi,
Source§fn from(s: &String) -> ManagedBuffer<M>
fn from(s: &String) -> ManagedBuffer<M>
Source§impl<M> From<&str> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> From<&str> for ManagedBuffer<M>where
M: ManagedTypeApi,
Source§fn from(s: &str) -> ManagedBuffer<M>
fn from(s: &str) -> ManagedBuffer<M>
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) -> ManagedBuffer<M>
fn from(bytes: BoxedBytes) -> ManagedBuffer<M>
Source§impl<M> From<Empty> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> From<Empty> for ManagedBuffer<M>where
M: ManagedTypeApi,
Source§fn from(_: Empty) -> ManagedBuffer<M>
fn from(_: Empty) -> ManagedBuffer<M>
Source§impl<M> From<ManagedBuffer<M>> for BigFloat<M>where
M: ManagedTypeApi,
impl<M> From<ManagedBuffer<M>> for BigFloat<M>where
M: ManagedTypeApi,
Source§fn from(item: ManagedBuffer<M>) -> BigFloat<M>
fn from(item: ManagedBuffer<M>) -> BigFloat<M>
Source§impl<M> From<ManagedBuffer<M>> for BigInt<M>where
M: ManagedTypeApi,
impl<M> From<ManagedBuffer<M>> for BigInt<M>where
M: ManagedTypeApi,
Source§fn from(item: ManagedBuffer<M>) -> BigInt<M>
fn from(item: ManagedBuffer<M>) -> BigInt<M>
Source§impl<M> From<ManagedBuffer<M>> for BigUint<M>where
M: ManagedTypeApi,
impl<M> From<ManagedBuffer<M>> for BigUint<M>where
M: ManagedTypeApi,
Source§fn from(item: ManagedBuffer<M>) -> BigUint<M>
fn from(item: ManagedBuffer<M>) -> BigUint<M>
Source§impl<M> From<ManagedBuffer<M>> for EgldOrEsdtTokenIdentifier<M>where
M: ManagedTypeApi,
impl<M> From<ManagedBuffer<M>> for EgldOrEsdtTokenIdentifier<M>where
M: ManagedTypeApi,
Source§fn from(buffer: ManagedBuffer<M>) -> EgldOrEsdtTokenIdentifier<M>
fn from(buffer: ManagedBuffer<M>) -> EgldOrEsdtTokenIdentifier<M>
Source§impl<M> From<ManagedBuffer<M>> for ManagedBufferReadToEnd<M>where
M: ManagedTypeApi,
impl<M> From<ManagedBuffer<M>> for ManagedBufferReadToEnd<M>where
M: ManagedTypeApi,
Source§fn from(buf: ManagedBuffer<M>) -> ManagedBufferReadToEnd<M>
fn from(buf: ManagedBuffer<M>) -> ManagedBufferReadToEnd<M>
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>) -> ManagedSCError<M>
fn from(message: ManagedBuffer<M>) -> ManagedSCError<M>
Source§impl<M> From<ManagedBuffer<M>> for TokenIdentifier<M>where
M: ManagedTypeApi,
impl<M> From<ManagedBuffer<M>> for TokenIdentifier<M>where
M: ManagedTypeApi,
Source§fn from(buffer: ManagedBuffer<M>) -> TokenIdentifier<M>
fn from(buffer: ManagedBuffer<M>) -> TokenIdentifier<M>
Source§impl<M> From<String> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> From<String> for ManagedBuffer<M>where
M: ManagedTypeApi,
Source§fn from(s: String) -> ManagedBuffer<M>
fn from(s: String) -> ManagedBuffer<M>
Source§impl<M> From<Vec<u8>> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> From<Vec<u8>> for ManagedBuffer<M>where
M: ManagedTypeApi,
Source§impl<M> ManagedType<M> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> ManagedType<M> for ManagedBuffer<M>where
M: ManagedTypeApi,
type OwnHandle = <M as HandleTypeInfo>::ManagedBufferHandle
fn get_handle(&self) -> <M as HandleTypeInfo>::ManagedBufferHandle
Source§unsafe fn forget_into_handle(
self,
) -> <ManagedBuffer<M> as ManagedType<M>>::OwnHandle
unsafe fn forget_into_handle( self, ) -> <ManagedBuffer<M> as ManagedType<M>>::OwnHandle
Source§fn transmute_from_handle_ref(
handle_ref: &<M as HandleTypeInfo>::ManagedBufferHandle,
) -> &ManagedBuffer<M>
fn transmute_from_handle_ref( handle_ref: &<M as HandleTypeInfo>::ManagedBufferHandle, ) -> &ManagedBuffer<M>
fn transmute_from_handle_ref_mut( handle_ref: &mut <M as HandleTypeInfo>::ManagedBufferHandle, ) -> &mut ManagedBuffer<M>
fn get_raw_handle(&self) -> i32
fn as_ref(&self) -> ManagedRef<'_, M, Self>
Source§impl<M> ManagedVecItem for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> ManagedVecItem for ManagedBuffer<M>where
M: ManagedTypeApi,
Source§const SKIPS_RESERIALIZATION: bool = false
const SKIPS_RESERIALIZATION: bool = false
u32
).Source§type PAYLOAD = ManagedVecItemPayloadBuffer<4>
type PAYLOAD = ManagedVecItemPayloadBuffer<4>
Source§type Ref<'a> = ManagedRef<'a, M, ManagedBuffer<M>>
type Ref<'a> = ManagedRef<'a, M, ManagedBuffer<M>>
Source§fn read_from_payload(
payload: &<ManagedBuffer<M> as ManagedVecItem>::PAYLOAD,
) -> ManagedBuffer<M>
fn read_from_payload( payload: &<ManagedBuffer<M> as ManagedVecItem>::PAYLOAD, ) -> ManagedBuffer<M>
Source§unsafe fn borrow_from_payload<'a>(
payload: &<ManagedBuffer<M> as ManagedVecItem>::PAYLOAD,
) -> <ManagedBuffer<M> as ManagedVecItem>::Ref<'a>
unsafe fn borrow_from_payload<'a>( payload: &<ManagedBuffer<M> as ManagedVecItem>::PAYLOAD, ) -> <ManagedBuffer<M> as ManagedVecItem>::Ref<'a>
Source§fn save_to_payload(
self,
payload: &mut <ManagedBuffer<M> as ManagedVecItem>::PAYLOAD,
)
fn save_to_payload( self, payload: &mut <ManagedBuffer<M> as ManagedVecItem>::PAYLOAD, )
fn payload_size() -> usize
Source§impl<M> NestedDecode for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> NestedDecode for ManagedBuffer<M>where
M: ManagedTypeApi,
Source§fn dep_decode_or_handle_err<I, H>(
input: &mut I,
h: H,
) -> Result<ManagedBuffer<M>, <H as DecodeErrorHandler>::HandledErr>where
I: NestedDecodeInput,
H: DecodeErrorHandler,
fn dep_decode_or_handle_err<I, H>(
input: &mut I,
h: H,
) -> Result<ManagedBuffer<M>, <H as DecodeErrorHandler>::HandledErr>where
I: NestedDecodeInput,
H: DecodeErrorHandler,
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,
Source§impl<M> NestedEncode for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> NestedEncode for ManagedBuffer<M>where
M: ManagedTypeApi,
Source§fn dep_encode_or_handle_err<O, H>(
&self,
dest: &mut O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: NestedEncodeOutput,
H: EncodeErrorHandler,
fn dep_encode_or_handle_err<O, H>(
&self,
dest: &mut O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: NestedEncodeOutput,
H: EncodeErrorHandler,
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,
Source§impl<M> NestedEncodeOutput for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> NestedEncodeOutput for ManagedBuffer<M>where
M: ManagedTypeApi,
fn supports_specialized_type<T>() -> boolwhere
T: TryStaticCast,
fn push_specialized<T, C, H>( &mut self, _context: C, value: &T, h: H, ) -> Result<(), <H as EncodeErrorHandler>::HandledErr>
Source§impl<M, const N: usize> PartialEq<&[u8; N]> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M, const N: usize> PartialEq<&[u8; N]> for ManagedBuffer<M>where
M: ManagedTypeApi,
Source§impl<M> PartialEq<[u8]> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> PartialEq<[u8]> for ManagedBuffer<M>where
M: ManagedTypeApi,
Source§impl<M> PartialEq for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> PartialEq for ManagedBuffer<M>where
M: ManagedTypeApi,
Source§impl<M> SCBinary for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> SCBinary for ManagedBuffer<M>where
M: ManagedTypeApi,
fn fmt<F>(&self, f: &mut F)where
F: FormatByteReceiver,
Source§impl<M> SCDisplay for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> SCDisplay for ManagedBuffer<M>where
M: ManagedTypeApi,
fn fmt<F>(&self, f: &mut F)where
F: FormatByteReceiver,
Source§impl<M> SCLowerHex for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> SCLowerHex for ManagedBuffer<M>where
M: ManagedTypeApi,
fn fmt<F>(&self, f: &mut F)where
F: FormatByteReceiver,
Source§impl<M> TopDecode for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> TopDecode for ManagedBuffer<M>where
M: ManagedTypeApi,
Source§fn top_decode_or_handle_err<I, H>(
input: I,
h: H,
) -> Result<ManagedBuffer<M>, <H as DecodeErrorHandler>::HandledErr>where
I: TopDecodeInput,
H: DecodeErrorHandler,
fn top_decode_or_handle_err<I, H>(
input: I,
h: H,
) -> Result<ManagedBuffer<M>, <H as DecodeErrorHandler>::HandledErr>where
I: TopDecodeInput,
H: DecodeErrorHandler,
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,
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]>
Source§fn into_max_size_buffer<H, const MAX_LEN: usize>(
self,
buffer: &mut [u8; MAX_LEN],
h: H,
) -> Result<&[u8], <H as DecodeErrorHandler>::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 as DecodeErrorHandler>::HandledErr>where
H: DecodeErrorHandler,
into_max_size_buffer_align_right
instead.Source§fn into_max_size_buffer_align_right<H, const MAX_LEN: usize>(
self,
buffer: &mut [u8; MAX_LEN],
h: H,
) -> Result<usize, <H as DecodeErrorHandler>::HandledErr>where
H: DecodeErrorHandler,
fn into_max_size_buffer_align_right<H, const MAX_LEN: usize>(
self,
buffer: &mut [u8; MAX_LEN],
h: H,
) -> Result<usize, <H as DecodeErrorHandler>::HandledErr>where
H: DecodeErrorHandler,
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,
fn supports_specialized_type<T>() -> boolwhere
T: TryStaticCast,
fn into_specialized<T, H>(
self,
h: H,
) -> Result<T, <H as DecodeErrorHandler>::HandledErr>where
T: TryStaticCast,
H: DecodeErrorHandler,
fn into_nested_buffer( self, ) -> <ManagedBuffer<M> as TopDecodeInput>::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,
Source§impl<M> TopEncode for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> TopEncode for ManagedBuffer<M>where
M: ManagedTypeApi,
Source§fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
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,
Source§impl<M> TopEncodeOutput for &mut ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> TopEncodeOutput for &mut ManagedBuffer<M>where
M: ManagedTypeApi,
Source§type NestedBuffer = ManagedBuffer<M>
type NestedBuffer = ManagedBuffer<M>
NestedEncodeOutput
that can be spawned to gather serializations of children.fn set_slice_u8(self, bytes: &[u8])
fn supports_specialized_type<T>() -> boolwhere
T: TryStaticCast,
Source§fn set_specialized<T, H>(
self,
value: &T,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
T: TryStaticCast,
H: EncodeErrorHandler,
fn set_specialized<T, H>(
self,
value: &T,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
T: TryStaticCast,
H: EncodeErrorHandler,
else_serialization
is only called when necessary and
is normally compiled out via monomorphization.fn start_nested_encode( &self, ) -> <&mut ManagedBuffer<M> as TopEncodeOutput>::NestedBuffer
fn finalize_nested_encode( self, nb: <&mut ManagedBuffer<M> as TopEncodeOutput>::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,
Source§type Error = DecodeError
type Error = DecodeError
Source§fn try_from(
value: ManagedBuffer<M>,
) -> Result<ManagedAddress<M>, <ManagedAddress<M> as TryFrom<ManagedBuffer<M>>>::Error>
fn try_from( value: ManagedBuffer<M>, ) -> Result<ManagedAddress<M>, <ManagedAddress<M> as TryFrom<ManagedBuffer<M>>>::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,
Source§type Error = DecodeError
type Error = DecodeError
Source§fn try_from(
value: ManagedBuffer<M>,
) -> Result<ManagedByteArray<M, N>, <ManagedByteArray<M, N> as TryFrom<ManagedBuffer<M>>>::Error>
fn try_from( value: ManagedBuffer<M>, ) -> Result<ManagedByteArray<M, N>, <ManagedByteArray<M, N> as TryFrom<ManagedBuffer<M>>>::Error>
Source§impl<M> TryStaticCast for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> TryStaticCast for ManagedBuffer<M>where
M: ManagedTypeApi,
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> TypeAbi for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> TypeAbi for ManagedBuffer<M>where
M: ManagedTypeApi,
type Unmanaged = Vec<u8>
fn type_name() -> String
fn type_name_rust() -> String
fn type_names() -> TypeNames
Source§fn provide_type_descriptions<TDC>(accumulator: &mut TDC)where
TDC: TypeDescriptionContainer,
fn provide_type_descriptions<TDC>(accumulator: &mut TDC)where
TDC: TypeDescriptionContainer,
impl<M> Eq for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<Env> TxCodeValue<Env> for ManagedBuffer<<Env as TxEnv>::Api>where
Env: TxEnv,
impl<M> TypeAbiFrom<&[u8]> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M, const N: usize> TypeAbiFrom<&[u8; N]> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> TypeAbiFrom<&BoxedBytes> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> TypeAbiFrom<&ManagedBuffer<M>> for BoxedByteswhere
M: ManagedTypeApi,
impl<M> TypeAbiFrom<&ManagedBuffer<M>> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> TypeAbiFrom<&ManagedBuffer<M>> for Stringwhere
M: ManagedTypeApi,
impl<M> TypeAbiFrom<&ManagedBuffer<M>> for Vec<u8>where
M: ManagedTypeApi,
impl<M> TypeAbiFrom<&String> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> TypeAbiFrom<&Vec<u8>> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> TypeAbiFrom<&str> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> TypeAbiFrom<BoxedBytes> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> TypeAbiFrom<ManagedBuffer<M>> for BoxedByteswhere
M: ManagedTypeApi,
impl<M> TypeAbiFrom<ManagedBuffer<M>> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> TypeAbiFrom<ManagedBuffer<M>> for Stringwhere
M: ManagedTypeApi,
impl<M> TypeAbiFrom<ManagedBuffer<M>> for Vec<u8>where
M: ManagedTypeApi,
impl<M> TypeAbiFrom<OperationCompletionStatus> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> TypeAbiFrom<String> for ManagedBuffer<M>where
M: ManagedTypeApi,
impl<M> TypeAbiFrom<Vec<u8>> for ManagedBuffer<M>where
M: ManagedTypeApi,
Auto Trait Implementations§
impl<M> Freeze for ManagedBuffer<M>
impl<M> RefUnwindSafe for ManagedBuffer<M>
impl<M> Send for ManagedBuffer<M>
impl<M> Sync for ManagedBuffer<M>
impl<M> Unpin for ManagedBuffer<M>
impl<M> UnwindSafe for ManagedBuffer<M>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> InterpretableFrom<&T> for Twhere
T: Clone,
impl<T> InterpretableFrom<&T> for Twhere
T: Clone,
fn interpret_from(from: &T, _context: &InterpreterContext) -> T
Source§impl<T> InterpretableFrom<T> for T
impl<T> InterpretableFrom<T> for T
fn interpret_from(from: T, _context: &InterpreterContext) -> T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ReconstructableFrom<&T> for Twhere
T: Clone,
impl<T> ReconstructableFrom<&T> for Twhere
T: Clone,
fn reconstruct_from(from: &T, _builder: &ReconstructorContext) -> T
Source§impl<T> ReconstructableFrom<T> for T
impl<T> ReconstructableFrom<T> for T
fn reconstruct_from(from: T, _builder: &ReconstructorContext) -> T
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
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 T
impl<T> TopDecodeMultiLength for T
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,
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.