pub trait AccountStorageCodec: Sized {
const STORED_SIZE: u32 = 62;
// Required methods
fn to_stored_bytes(self) -> Result<[u8; 62], AccountEncodeError>;
fn to_bytes(self) -> Result<Vec<u8>, AccountEncodeError>;
fn try_from_bytes(bytes: &[u8]) -> Result<Self, AccountDecodeError>;
}Expand description
Core-owned fixed account storage codec.
Provided Associated Constants§
Sourceconst STORED_SIZE: u32 = 62
const STORED_SIZE: u32 = 62
Canonical fixed storage size.
Required Methods§
Sourcefn to_stored_bytes(self) -> Result<[u8; 62], AccountEncodeError>
fn to_stored_bytes(self) -> Result<[u8; 62], AccountEncodeError>
Encode without heap allocation.
§Errors
Returns an error when the owner principal cannot fit the canonical fixed-width representation.
Sourcefn to_bytes(self) -> Result<Vec<u8>, AccountEncodeError>
fn to_bytes(self) -> Result<Vec<u8>, AccountEncodeError>
Encode into owned fixed bytes.
§Errors
Returns an error when the owner principal cannot fit the canonical fixed-width representation.
Sourcefn try_from_bytes(bytes: &[u8]) -> Result<Self, AccountDecodeError>
fn try_from_bytes(bytes: &[u8]) -> Result<Self, AccountDecodeError>
Decode the current fixed storage representation.
§Errors
Returns an error for a wrong-sized or non-canonical payload.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".