pub struct Signature {
pub magic: u32,
pub magic2: u32,
pub version: u32,
pub offset: u32,
pub size: u32,
pub cpu_type: u32,
}Expand description
aka. Magic number
Fields§
§magic: u32§magic2: u32§version: u32§offset: u32§size: u32§cpu_type: u32Implementations§
Source§impl Signature
impl Signature
Sourcepub fn parse(data: &[u8]) -> Option<(Self, &[u8])>
pub fn parse(data: &[u8]) -> Option<(Self, &[u8])>
Examples found in repository?
examples/llvm_bca.rs (line 16)
9fn main() {
10 let path = std::env::args()
11 .nth(1)
12 .expect("Provide file path to a .bc file");
13 let file = std::fs::read(&path).unwrap();
14
15 let mut reader = BitStreamReader::new();
16 let (sig, bitcode) = Signature::parse(&file).unwrap();
17
18 println!(
19 "<BITCODE_WRAPPER_HEADER Magic=0x{:08x} Version=0x{:08x} Offset=0x{:08x} Size=0x{:08x} CPUType=0x{:08x}/>",
20 sig.magic, sig.version, sig.offset, sig.size, sig.cpu_type
21 );
22 iter_block(reader.iter_bitcode(bitcode), 0).unwrap();
23}Trait Implementations§
Source§impl Ord for Signature
impl Ord for Signature
Source§impl PartialOrd for Signature
impl PartialOrd for Signature
impl Copy for Signature
impl Eq for Signature
impl StructuralPartialEq for Signature
Auto Trait Implementations§
impl Freeze for Signature
impl RefUnwindSafe for Signature
impl Send for Signature
impl Sync for Signature
impl Unpin for Signature
impl UnwindSafe for Signature
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more