Coverage Report

Created: 2026-11-11 06:34

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/scroll-0.12.0/src/endian.rs
Line
Count
Source
1
#[derive(PartialEq, Eq, Copy, Debug, Clone)]
2
/// The endianness (byte order) of a stream of bytes
3
pub enum Endian {
4
    Little,
5
    Big,
6
}
7
8
/// Little Endian byte order context
9
pub const LE: Endian = Endian::Little;
10
/// Big Endian byte order context
11
pub const BE: Endian = Endian::Big;
12
/// Network byte order context
13
pub const NETWORK: Endian = Endian::Big;
14
#[cfg(target_endian = "little")]
15
/// The machine's native byte order
16
pub const NATIVE: Endian = LE;
17
#[cfg(target_endian = "big")]
18
/// The machine's native byte order
19
pub const NATIVE: Endian = BE;
20
21
impl Default for Endian {
22
    #[inline]
23
49.0k
    fn default() -> Self {
24
49.0k
        NATIVE
25
49.0k
    }
<scroll::endian::Endian as core::default::Default>::default
Line
Count
Source
23
49.0k
    fn default() -> Self {
24
49.0k
        NATIVE
25
49.0k
    }
Unexecuted instantiation: <scroll::endian::Endian as core::default::Default>::default
26
}
27
28
impl From<bool> for Endian {
29
    #[inline]
30
0
    fn from(little_endian: bool) -> Self {
31
0
        if little_endian {
32
0
            LE
33
        } else {
34
0
            BE
35
        }
36
0
    }
37
}
38
39
impl Endian {
40
    #[inline]
41
0
    pub fn network() -> Endian {
42
0
        NETWORK
43
0
    }
44
    #[inline]
45
15.3M
    pub fn is_little(&self) -> bool {
46
15.3M
        *self == LE
47
15.3M
    }
<scroll::endian::Endian>::is_little
Line
Count
Source
45
15.3M
    pub fn is_little(&self) -> bool {
46
15.3M
        *self == LE
47
15.3M
    }
Unexecuted instantiation: <scroll::endian::Endian>::is_little
48
}