domain::base::wire

Function parse_slice

source
pub fn parse_slice<F, T>(data: &[u8], op: F) -> Result<T, ParseError>
where F: FnOnce(&mut Parser<'_, [u8]>) -> Result<T, ParseError>,
Expand description

Parses something from a Vec<u8>.

The actual parsing happens in the provided closure. Returns an error if the closure returns an error or if there is unparsed data left over after the closure returns. Otherwise returns whatever the closure returned.