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§
Provided Methods§
Sourcefn get_packed_len() -> usize
fn get_packed_len() -> usize
Get the packed length
Sourcefn unpack(input: &[u8]) -> Result<Self, ProgramError>where
Self: IsInitialized,
fn unpack(input: &[u8]) -> Result<Self, ProgramError>where
Self: IsInitialized,
Unpack from slice and check if initialized
Sourcefn unpack_unchecked(input: &[u8]) -> Result<Self, ProgramError>
fn unpack_unchecked(input: &[u8]) -> Result<Self, ProgramError>
Unpack from slice without checking if initialized
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.