[][src]Trait spl_token::pack::Pack

pub trait Pack: Sealed {
    const LEN: usize;
    fn unpack(input: &[u8]) -> Result<Self, ProgramError>
    where
        Self: IsInitialized
, { ... }
fn unpack_unchecked(input: &[u8]) -> Result<Self, ProgramError> { ... }
fn unpack_mut<F, U>(input: &mut [u8], f: &mut F) -> Result<U, ProgramError>
    where
        F: FnMut(&mut Self) -> Result<U, ProgramError>,
        Self: IsInitialized
, { ... }
fn unpack_unchecked_mut<F, U>(
        input: &mut [u8],
        f: &mut F
    ) -> Result<U, ProgramError>
    where
        F: FnMut(&mut Self) -> Result<U, ProgramError>
, { ... }
fn pack(src: Self, dst: &mut [u8]) -> Result<(), ProgramError> { ... } }

Safely and efficiently (de)serialize account state

Associated Constants

const LEN: usize

The length, in bytes, of the packed representation

Loading content...

Provided methods

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

Unpack from slice and check if initialized

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

Unpack from slice without checking if initialized

fn unpack_mut<F, U>(input: &mut [u8], f: &mut F) -> Result<U, ProgramError> where
    F: FnMut(&mut Self) -> Result<U, ProgramError>,
    Self: IsInitialized

Borrow Self from input for the duration of the call to f, but first check that Self is initialized

fn unpack_unchecked_mut<F, U>(
    input: &mut [u8],
    f: &mut F
) -> Result<U, ProgramError> where
    F: FnMut(&mut Self) -> Result<U, ProgramError>, 

Borrow Self from input for the duration of the call to f, without checking that Self has been initialized

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

Pack into slice

Loading content...

Implementors

Loading content...