pub struct JsonPayloadDecoderRegistry { /* private fields */ }Expand description
Heterogeneous per-key payload decoder registry.
One registry may contain the union of keys used by several output streams. Coverage therefore requires every selected key but permits additional registrations. Keys are exact and are not trimmed or case-normalized.
This type is intentionally non-Clone because registered decoders may own caches, handles, or synchronization state with unknown clone semantics.
Implementations§
Source§impl JsonPayloadDecoderRegistry
impl JsonPayloadDecoderRegistry
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates an empty registry with capacity for at least capacity keys.
Sourcepub fn with_json_field<T>(
self,
key: impl Into<String>,
) -> Result<Self, StorageError>
pub fn with_json_field<T>( self, key: impl Into<String>, ) -> Result<Self, StorageError>
Adds a field decoded directly through Serde JSON into T.
This is the concise path for payload types whose JSON representation
already matches their Rust representation. Specialized decoders remain
available through JsonPayloadDecoderRegistry::register_for_field
when conversion requires configuration, validation, or a different
wire shape.
§Errors
Returns the same empty-key or duplicate-key errors as
JsonPayloadDecoderRegistry::register_for_field. Payload parse
failures are reported later with their field context by the reader.
Sourcepub fn register_for_field<T, D>(
&mut self,
key: impl Into<String>,
decoder: D,
) -> Result<(), StorageError>
pub fn register_for_field<T, D>( &mut self, key: impl Into<String>, decoder: D, ) -> Result<(), StorageError>
Registers one typed decoder under one exact state field key.
Successful decoded values are moved directly into SystemState; the
adapter never invokes T::clone.
§Errors
Returns StorageError::InvalidConfiguration for an empty key and
StorageError::DuplicateDecoder for an existing key. The incoming
decoder is dropped on either configuration error.
Sourcepub fn has_decoder_for_field(&self, key: &str) -> bool
pub fn has_decoder_for_field(&self, key: &str) -> bool
Reports whether an exact field key has a registered decoder.
Sourcepub fn registered_field_names(&self) -> impl ExactSizeIterator<Item = &str>
pub fn registered_field_names(&self) -> impl ExactSizeIterator<Item = &str>
Iterates registered keys in unspecified hash-map order.
Reader dispatch never uses this order. Callers needing stable display should sort the returned strings.
Trait Implementations§
Source§impl Debug for JsonPayloadDecoderRegistry
impl Debug for JsonPayloadDecoderRegistry
Source§impl Default for JsonPayloadDecoderRegistry
impl Default for JsonPayloadDecoderRegistry
Source§fn default() -> JsonPayloadDecoderRegistry
fn default() -> JsonPayloadDecoderRegistry
Auto Trait Implementations§
impl !RefUnwindSafe for JsonPayloadDecoderRegistry
impl !UnwindSafe for JsonPayloadDecoderRegistry
impl Freeze for JsonPayloadDecoderRegistry
impl Send for JsonPayloadDecoderRegistry
impl Sync for JsonPayloadDecoderRegistry
impl Unpin for JsonPayloadDecoderRegistry
impl UnsafeUnpin for JsonPayloadDecoderRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more