Skip to main content

read_as_bytes

Function read_as_bytes 

Source
pub fn read_as_bytes(input: TakeBytes) -> Result<Vec<u8>, DecodingError>
Expand description

Read the entire contents from the input source as bytes.

This is a convenience function that wraps TakeBytes::try_into_bytes and converts the error to DecodingError.

§Example

use take_bytes::{TakeBytes, read_as_bytes};

let input: TakeBytes = "-".parse()?;
let bytes = read_as_bytes(input)?;