bootsector 0.2.0

Read partitions from block devices or files
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::convert::TryInto;

#[inline]
pub fn read_u16(slice: &[u8]) -> u16 {
    u16::from_le_bytes(slice[..2].try_into().expect("fixed size slice"))
}

#[inline]
pub fn read_u32(slice: &[u8]) -> u32 {
    u32::from_le_bytes(slice[..4].try_into().expect("fixed size slice"))
}

#[inline]
pub fn read_u64(slice: &[u8]) -> u64 {
    u64::from_le_bytes(slice[..8].try_into().expect("fixed size slice"))
}