1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
mod traits; pub use self::traits::Section; mod section_type; pub use self::section_type::{SectionKind,SectionType}; mod attributes; pub use self::attributes::{SectionAttributes,SectMemAttrib}; mod section64; mod section32; mod section; pub use self::section::{Sections, SectionsIter}; use std::borrow::Cow; pub fn find_null<'a>(buffer: &'a [u8]) -> Option<Cow<'a,str>> { let mut term = 0usize; let len = buffer.len(); for i in 0..len { if buffer[i] == 0 { break; } else { term += 1; continue; } } let temp = &buffer[0..term]; Some(String::from_utf8_lossy(temp)) }