pub trait Pack: Sealed {
    const LEN: usize;

    // Provided methods
    fn get_packed_len() -> usize { ... }
    fn unpack(input: &[u8]) -> Result<Self, ProgramError>
       where Self: IsInitialized { ... }
    fn unpack_unchecked(input: &[u8]) -> Result<Self, ProgramError> { ... }
    fn pack(src: Self, dst: &mut [u8]) -> Result<(), ProgramError> { ... }
}
Expand description

Safely and efficiently (de)serialize account state

Required Associated Constants§

source

const LEN: usize

The length, in bytes, of the packed representation

Provided Methods§

source

fn get_packed_len() -> usize

Get the packed length

source

fn unpack(input: &[u8]) -> Result<Self, ProgramError>where Self: IsInitialized,

Unpack from slice and check if initialized

source

fn unpack_unchecked(input: &[u8]) -> Result<Self, ProgramError>

Unpack from slice without checking if initialized

source

fn pack(src: Self, dst: &mut [u8]) -> Result<(), ProgramError>

Pack into slice

Implementors§