Skip to main content

PersistedFieldMetaCodec

Trait PersistedFieldMetaCodec 

Source
pub trait PersistedFieldMetaCodec: FieldTypeMeta + Sized {
    // Required methods
    fn encode_persisted_slot_payload_by_meta(
        &self,
        field_name: &'static str,
    ) -> Result<Vec<u8>, InternalError>;
    fn decode_persisted_slot_payload_by_meta(
        bytes: &[u8],
        field_name: &'static str,
    ) -> Result<Self, InternalError>;
    fn encode_persisted_option_slot_payload_by_meta(
        value: &Option<Self>,
        field_name: &'static str,
    ) -> Result<Vec<u8>, InternalError>;
    fn decode_persisted_option_slot_payload_by_meta(
        bytes: &[u8],
        field_name: &'static str,
    ) -> Result<Option<Self>, InternalError>;
}
Expand description

PersistedFieldMetaCodec

PersistedFieldMetaCodec lets one field type own the persisted-row encode/decode contract selected by its FieldTypeMeta. This keeps the meta-hinted persisted-row path on the field-type owner instead of forcing row helpers to require both the by-kind and direct structured codec traits at once.

Required Methods§

Source

fn encode_persisted_slot_payload_by_meta( &self, field_name: &'static str, ) -> Result<Vec<u8>, InternalError>

Encode one non-optional field payload through the type’s own FieldTypeMeta storage contract.

Source

fn decode_persisted_slot_payload_by_meta( bytes: &[u8], field_name: &'static str, ) -> Result<Self, InternalError>

Decode one non-optional field payload through the type’s own FieldTypeMeta storage contract.

Source

fn encode_persisted_option_slot_payload_by_meta( value: &Option<Self>, field_name: &'static str, ) -> Result<Vec<u8>, InternalError>

Encode one optional field payload through the inner type’s own FieldTypeMeta storage contract.

Source

fn decode_persisted_option_slot_payload_by_meta( bytes: &[u8], field_name: &'static str, ) -> Result<Option<Self>, InternalError>

Decode one optional field payload through the inner type’s own FieldTypeMeta storage contract.

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.

Implementors§