multiversx_sc_snippets::imports

Trait ManagedVecItemPayload

Source
pub trait ManagedVecItemPayload {
    // Required methods
    fn new_buffer() -> Self;
    fn payload_size() -> usize;
    fn payload_slice(&self) -> &[u8] ;
    fn payload_slice_mut(&mut self) -> &mut [u8] ;
    unsafe fn slice_unchecked<S>(&self, index: usize) -> &S
       where S: ManagedVecItemPayload;
    unsafe fn slice_unchecked_mut<S>(&mut self, index: usize) -> &mut S
       where S: ManagedVecItemPayload;
}
Expand description

Describes the binary represetnation of a ManagedVecItem.

It is always an array that can be allocated directly on stack.

Required Methods§

Source

fn new_buffer() -> Self

Source

fn payload_size() -> usize

Source

fn payload_slice(&self) -> &[u8]

Source

fn payload_slice_mut(&mut self) -> &mut [u8]

Source

unsafe fn slice_unchecked<S>(&self, index: usize) -> &S

Takes a sub-payload item.

§Safety

Only works correctly if the given index is correct, otherwise undefined behavior is possible.

Source

unsafe fn slice_unchecked_mut<S>(&mut self, index: usize) -> &mut S

Takes a sub-payload item.

§Safety

Only works correctly if the given index is correct, otherwise undefined behavior is possible.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§