pub fn raw_auditable_data<'a>(data: &'a [u8]) -> Result<&'a [u8], Error> {
    match binfarce::detect_format(data) {
        Format::Elf32{byte_order} => {
            let section = binfarce::elf32::parse(data, byte_order)?
                .section_with_name(".rust-deps-v0")?.ok_or(Error::NoAuditData)?;
            Ok(data.get(section.range()?).ok_or(Error::UnexpectedEof)?)
        },
        Format::Elf64{byte_order} => {
            let section = binfarce::elf64::parse(data, byte_order)?
                .section_with_name(".rust-deps-v0")?.ok_or(Error::NoAuditData)?;
            Ok(data.get(section.range()?).ok_or(Error::UnexpectedEof)?)
        },
        Format::Macho => {
            let parsed = binfarce::macho::parse(data)?;
            let section = parsed.section_with_name("__TEXT", "rust-deps-v0")?;
            let section = section.ok_or(Error::NoAuditData)?;
            Ok(data.get(section.range()?).ok_or(Error::UnexpectedEof)?)
        },
        Format::PE => {
            let parsed = binfarce::pe::parse(data)?;
            let section = parsed.section_with_name("rdep-v0")?.ok_or(Error::NoAuditData)?;
            Ok(data.get(section.range()?).ok_or(Error::UnexpectedEof)?)
        }
        _ => Err(Error::NotAnExecutable)
    }
}
/// Extracts the Zlib-compressed dependency info from an executable.
///
/// This function does not allocate any memory on the heap and can be safely given untrusted input.
Extracts the Zlib-compressed dependency info from an executable.
This function does not allocate any memory on the heap and can be safely given untrusted input.
Extracts the Zlib - compressed dependency info from an executable . This function does not allocate any memory on the heap and can be safely given untrusted input .
pub fn raw_auditable_data<'a>(data: &'a [u8]) -> Result<&'a [u8], Error> {
    match binfarce::detect_format(data) {
        Format::Elf32{byte_order} => {
            let section = binfarce::elf32::parse(data, byte_order)?
                .section_with_name(".rust-deps-v0")?.ok_or(Error::NoAuditData)?;
            Ok(data.get(section.range()?).ok_or(Error::UnexpectedEof)?)
        },
        Format::Elf64{byte_order} => {
            let section = binfarce::elf64::parse(data, byte_order)?
                .section_with_name(".rust-deps-v0")?.ok_or(Error::NoAuditData)?;
            Ok(data.get(section.range()?).ok_or(Error::UnexpectedEof)?)
        },
        Format::Macho => {
            let parsed = binfarce::macho::parse(data)?;
            let section = parsed.section_with_name("__TEXT", "rust-deps-v0")?;
            let section = section.ok_or(Error::NoAuditData)?;
            Ok(data.get(section.range()?).ok_or(Error::UnexpectedEof)?)
        },
        Format::PE => {
            let parsed = binfarce::pe::parse(data)?;
            let section = parsed.section_with_name("rdep-v0")?.ok_or(Error::NoAuditData)?;
            Ok(data.get(section.range()?).ok_or(Error::UnexpectedEof)?)
        }
        _ => Err(Error::NotAnExecutable)
    }
}
pub fn raw_auditable_data < ' a > ( data : & ' a [ u8 ] ) -> Result < & ' a [ u8 ] , Error > { match binfarce :: detect_format ( data ) { Format :: Elf32 { byte_order } => { let section = binfarce :: elf32 :: parse ( data , byte_order ) ? . section_with_name ( " " ) ? . ok_or ( Error :: NoAuditData ) ? ; Ok ( data . get ( section . range ( ) ? ) . ok_or ( Error :: UnexpectedEof ) ? ) } , Format :: Elf64 { byte_order } => { let section = binfarce :: elf64 :: parse ( data , byte_order ) ? . section_with_name ( " " ) ? . ok_or ( Error :: NoAuditData ) ? ; Ok ( data . get ( section . range ( ) ? ) . ok_or ( Error :: UnexpectedEof ) ? ) } , Format :: Macho => { let parsed = binfarce :: macho :: parse ( data ) ? ; let section = parsed . section_with_name ( " " , " " ) ? ; let section = section . ok_or ( Error :: NoAuditData ) ? ; Ok ( data . get ( section . range ( ) ? ) . ok_or ( Error :: UnexpectedEof ) ? ) } , Format :: PE => { let parsed = binfarce :: pe :: parse ( data ) ? ; let section = parsed . section_with_name ( " " ) ? . ok_or ( Error :: NoAuditData ) ? ; Ok ( data . get ( section . range ( ) ? ) . ok_or ( Error :: UnexpectedEof ) ? ) } _ => Err ( Error :: NotAnExecutable ) } }
Extracts the Zlib-compressed dependency info from an executable.
Extracts the Zlib - compressed dependency info from an executable .
data
&'a [u8]