Struct chain_core::abor::Encoder

pub struct Encoder {
    data: Vec<u8, Global>,
    hole: Vec<(usize, usize), Global>,
    current_element: usize,
}
Expand description

ABOR Encoder

Fields§

§data: Vec<u8, Global>§hole: Vec<(usize, usize), Global>§current_element: usize

Implementations§

§

impl Encoder

pub fn new() -> Encoder

pub fn u8(self, u: u8) -> Encoder

Add an unsigned byte

pub fn u16(self, u: u16) -> Encoder

Add a 16-bit unsigned value in little endian format

pub fn u32(self, u: u32) -> Encoder

Add a 32-bit unsigned value in little endian format

pub fn u64(self, u: u64) -> Encoder

Add a 64-bit unsigned value in little endian format

pub fn u128(self, u: u128) -> Encoder

Add a 128-bit unsigned value in little endian format

pub fn bytes(self, bs: &[u8]) -> Encoder

cannot serialize more than 256 bytes of contiguous data

pub fn struct_start(self) -> Encoder

Array cannot contain more than 256 elements

pub fn struct_end(self) -> Encoder

Terminate an array

pub fn finalize(self) -> Box<[u8], Global>

Finalize the encoder into an immutable array of data

Trait Implementations§

§

impl Default for Encoder

§

fn default() -> Encoder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.