fn parse(body: impl Into<BytesWrapper>) -> nom::IResult<BytesWrapper, (Bytes, Bytes)> {
    use nom::{bytes::complete::take, combinator::map_res};
    use std::array::TryFromSliceError;

    let body = body.into();

    let u32_from_le_bytes =
        |b: BytesWrapper| Ok::<_, TryFromSliceError>(u32::from_le_bytes((&b[..]).try_into()?));
    let mut read_u32 = map_res(take(4_usize), u32_from_le_bytes);

    let (rest, metadata_length) = read_u32(body)?;
    let (rest, metadata_bytes) = take(metadata_length)(rest)?;
    let (rest, crate_length) = read_u32(rest)?;
    let (rest, crate_bytes) = take(crate_length)(rest)?;

    Ok((rest, (metadata_bytes.into(), crate_bytes.into())))
}
/// Cargo sends the metadata and crate packed together and prepended with a single `u32`
/// representing how many bytes are in the next section, we'll parse these two byte chunks
/// out and return them `(Metadata, Crate)`.
Cargo sends the metadata and crate packed together and prepended with a single `u32`
representing how many bytes are in the next section, we'll parse these two byte chunks
out and return them `(Metadata, Crate)`.
Cargo sends the metadata and crate packed together and prepended with a single ` u32 ` representing how many bytes are in the next section we ' ll parse these two byte chunks out and return them ` ( Metadata Crate ) ` .
fn parse(body: impl Into<BytesWrapper>) -> nom::IResult<BytesWrapper, (Bytes, Bytes)> {
    use nom::{bytes::complete::take, combinator::map_res};
    use std::array::TryFromSliceError;
    let body = body.into();
    let u32_from_le_bytes =
        |b: BytesWrapper| Ok::<_, TryFromSliceError>(u32::from_le_bytes((&b[..]).try_into()?));
    let mut read_u32 = map_res(take(4_usize), u32_from_le_bytes);
    let (rest, metadata_length) = read_u32(body)?;
    let (rest, metadata_bytes) = take(metadata_length)(rest)?;
    let (rest, crate_length) = read_u32(rest)?;
    let (rest, crate_bytes) = take(crate_length)(rest)?;
    Ok((rest, (metadata_bytes.into(), crate_bytes.into())))
}
fn parse ( body : impl Into < BytesWrapper > ) -> nom :: IResult < BytesWrapper , ( Bytes , Bytes ) > { use nom :: { bytes :: complete :: take , combinator :: map_res } ; use std :: array :: TryFromSliceError ; let body = body . into ( ) ; let u32_from_le_bytes = | b : BytesWrapper | Ok :: < _ , TryFromSliceError > ( u32 :: from_le_bytes ( ( & b [ .. ] ) . try_into ( ) ? ) ) ; let mut read_u32 = map_res ( take ( 4_usize ) , u32_from_le_bytes ) ; let ( rest , metadata_length ) = read_u32 ( body ) ? ; let ( rest , metadata_bytes ) = take ( metadata_length ) ( rest ) ? ; let ( rest , crate_length ) = read_u32 ( rest ) ? ; let ( rest , crate_bytes ) = take ( crate_length ) ( rest ) ? ; Ok ( ( rest , ( metadata_bytes . into ( ) , crate_bytes . into ( ) ) ) ) }
Cargo sends the metadata and crate packed together and prepended with a single `u32`
representing how many bytes are in the next section, we'll parse these two byte chunks
out and return them `(Metadata, Crate)`.
Cargo sends the metadata and crate packed together and prepended with a single ` u32 ` representing how many bytes are in the next section we ' ll parse these two byte chunks out and return them ` ( Metadata Crate ) ` .
body
impl Into<BytesWrapper>
body
impl Into<BytesWrapper>