Skip to main content

Decoder

Type Alias Decoder 

Source
pub type Decoder = Arc<dyn Fn(&[u8], &str) -> Result<Value, String> + Send + Sync>;
Expand description

Turns a body of one media type into the value its schema judges.

Called with the bytes and the media type they arrived as — the latter matters when one decoder is registered for a range like text/*. An Err is reported as a malformed body, carrying the reason given.

Aliased Type§

pub struct Decoder { /* private fields */ }