pub fn read_option_cb<R: ::std::io::Read, T, F>(
    reader: &mut R,
    cb: &F,
) -> Result<Option<T>, DecodeError>
where
    F: Fn(&mut R) -> Result<T, DecodeError>,
{
    let prefix: u8 = Readable::read(reader)?;
    let res = match prefix {
        0 => None,
        1 => Some(cb(reader)?),
        _ => return Err(DecodeError::InvalidValue),
    };
    Ok(res)
}
/// Reads an option using the provided callback to deserialize the inner value (if any).
Reads an option using the provided callback to deserialize the inner value (if any).
Reads an option using the provided callback to deserialize the inner value ( if any ) .
pub fn read_option_cb<R: ::std::io::Read, T, F>(
    reader: &mut R,
    cb: &F,
) -> Result<Option<T>, DecodeError>
where
    F: Fn(&mut R) -> Result<T, DecodeError>,
{
    let prefix: u8 = Readable::read(reader)?;
    let res = match prefix {
        0 => None,
        1 => Some(cb(reader)?),
        _ => return Err(DecodeError::InvalidValue),
    };
    Ok(res)
}
pub fn read_option_cb < R : :: std :: io :: Read , T , F > ( reader : & mut R , cb : & F , ) -> Result < Option < T > , DecodeError > where F : Fn ( & mut R ) -> Result < T , DecodeError > , { let prefix : u8 = Readable :: read ( reader ) ? ; let res = match prefix { 0 => None , 1 => Some ( cb ( reader ) ? ) , _ => return Err ( DecodeError :: InvalidValue ) , } ; Ok ( res ) }
Reads an option using the provided callback to deserialize the inner value (if any).
Reads an option using the provided callback to deserialize the inner value ( if any ) .
reader
&mut R
cb
&F