Skip to main content

read_value

Function read_value 

Source
pub fn read_value<R, T>(
    reader: &mut R,
    codec: &dyn Codec,
    max_bytes: usize,
) -> AppResult<Option<T>>
where R: Read, T: DeserializeOwned,
Expand description

Read one frame and decode it into T through codec.

Returns Ok(None) on a clean end-of-stream between frames.

ยงErrors

Returns a typed AppError (cause preserved) on a transport failure or a payload that does not decode into T.