Skip to main content

JsonPayloadDecoder

Trait JsonPayloadDecoder 

Source
pub trait JsonPayloadDecoder<T>:
    Send
    + Sync
    + 'static {
    type Error: Error + Send + Sync + 'static;

    // Required method
    fn decode_json_payload(&self, raw_json: &str) -> Result<T, Self::Error>;
}
Expand description

Converts one borrowed raw JSON value into one concrete state payload.

T stays explicit at this boundary. Any thread-safe Fn(&str) -> Result<T, E> implements the trait automatically; named decoder types may implement it directly when they own configuration or shared state.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Decoder-specific failure retained by StorageError::DecodeField.

Required Methods§

Source

fn decode_json_payload(&self, raw_json: &str) -> Result<T, Self::Error>

Decodes exactly one complete raw JSON value into an owned payload.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§