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§
Sourcefn encode_persisted_slot_payload_by_meta(
&self,
field_name: &'static str,
) -> Result<Vec<u8>, InternalError>
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.
Sourcefn decode_persisted_slot_payload_by_meta(
bytes: &[u8],
field_name: &'static str,
) -> Result<Self, InternalError>
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.
Sourcefn encode_persisted_option_slot_payload_by_meta(
value: &Option<Self>,
field_name: &'static str,
) -> Result<Vec<u8>, InternalError>
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.
Sourcefn decode_persisted_option_slot_payload_by_meta(
bytes: &[u8],
field_name: &'static str,
) -> Result<Option<Self>, InternalError>
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.