Coverage Report

Created: 2026-03-20 06:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/scroll-0.10.2/src/pread.rs
Line
Count
Source
1
use core::result;
2
use core::ops::{Index, RangeFrom};
3
4
use crate::ctx::{TryFromCtx, MeasureWith};
5
use crate::error;
6
7
/// A very generic, contextual pread interface in Rust. 
8
///
9
/// Like [Pwrite](trait.Pwrite.html) — but for reading!
10
///
11
/// Implementing `Pread` on a data store allows you to then read almost arbitrarily complex types
12
/// efficiently.
13
///
14
/// To this end the Pread trait works in conjuction with the [TryFromCtx](ctx/trait.TryFromCtx.html);
15
/// The `TryFromCtx` trait implemented on a type defines how to convert data to an object of that
16
/// type, the Pread trait implemented on a data store defines how to extract said data from that
17
/// store.
18
///
19
/// It should be noted though that in this context, data does not necessarily mean `&[u8]` —
20
/// `Pread` and `TryFromCtx` are generic over what 'data' means and could be implemented instead
21
/// over chunks of memory or any other indexable type — but scroll does come with a set of powerful
22
/// blanket implementations for data being a continous block of byte-addressable memory.
23
///
24
/// Pread provides two main groups of functions: pread and gread.
25
///
26
/// `pread` is the basic function that simply extracts a given type from a given data store - either
27
/// using a provided Context in the case of [pread_with](trait.Pread.html#method.pread_with) or
28
/// with the default context for the given type in the case of [pread](trait.Pread.html#method.pread)
29
///
30
/// `gread` does in addition to that update the offset it's currently at, allowing for a cursored
31
/// read — `gread_inout` expands on that and reads a number of continous types from the data store.
32
/// gread again comes with `_with` variants to allow using a specific context.
33
///
34
/// Since pread and friends are very generic functions their types are rather complex, but very
35
/// much understandable; `TryFromCtx` is generic over `Ctx` ([described
36
/// here](ctx/index.html#context)), `Output` and `Error`. The Error type is hopefully
37
/// self-explanatory, however the `Output` type is rather important; it defines what Pread extracts
38
/// from the data store and has to match up with what `TryFromCtx` expects as input to convert into
39
/// the resulting type. scroll defaults to `&[u8]` here.
40
///
41
/// Unless you need to implement your own data store — that is either can't convert to `&[u8]` or
42
/// have a data that is not `&[u8]` — you will probably want to implement
43
/// [TryFromCtx](ctx/trait.TryFromCtx.html) on your Rust types to be extracted.
44
///
45
pub trait Pread<Ctx, E> : Index<usize> + Index<RangeFrom<usize>> + MeasureWith<Ctx>
46
 where
47
       Ctx: Copy,
48
       E: From<error::Error>,
49
{
50
    #[inline]
51
    /// Reads a value from `self` at `offset` with a default `Ctx`. For the primitive numeric values, this will read at the machine's endianness.
52
    /// # Example
53
    /// ```rust
54
    /// use scroll::Pread;
55
    /// let bytes = [0x7fu8; 0x01];
56
    /// let byte = bytes.pread::<u8>(0).unwrap();
57
110M
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
110M
        self.pread_with(offset, Ctx::default())
59
110M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim::secure_boot::PayloadSignHeader>
Line
Count
Source
57
1.76k
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
1.76k
        self.pread_with(offset, Ctx::default())
59
1.76k
    }
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::metadata::TdxMetadataSection>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::metadata::TdxMetadataDescriptor>
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::fv::FfsFileHeader>
Line
Count
Source
57
12.2k
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
12.2k
        self.pread_with(offset, Ctx::default())
59
12.2k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::fv::FfsFileHeader2>
Line
Count
Source
57
6.76k
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
6.76k
        self.pread_with(offset, Ctx::default())
59
6.76k
    }
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::fv::CommonSectionHeader>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::fv::CommonSectionHeader2>
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::fv::FirmwareVolumeHeader>
Line
Count
Source
57
1.76k
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
1.76k
        self.pread_with(offset, Ctx::default())
59
1.76k
    }
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::hob::GuidExtension>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::hob::FirmwareVolume>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::hob::HandoffInfoTable>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::hob::MemoryAllocation>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::hob::ResourceDescription>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::hob::Cpu>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::hob::Header>
Unexecuted instantiation: <_ as scroll::pread::Pread<_, _>>::pread::<_>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::metadata::TdxMetadataSection>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::metadata::TdxMetadataDescriptor>
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::fv::FfsFileHeader>
Line
Count
Source
57
20.4k
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
20.4k
        self.pread_with(offset, Ctx::default())
59
20.4k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::fv::FfsFileHeader2>
Line
Count
Source
57
13.6k
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
13.6k
        self.pread_with(offset, Ctx::default())
59
13.6k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::fv::CommonSectionHeader>
Line
Count
Source
57
1.24k
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
1.24k
        self.pread_with(offset, Ctx::default())
59
1.24k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::fv::CommonSectionHeader2>
Line
Count
Source
57
515
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
515
        self.pread_with(offset, Ctx::default())
59
515
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::fv::FirmwareVolumeHeader>
Line
Count
Source
57
2.59k
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
2.59k
        self.pread_with(offset, Ctx::default())
59
2.59k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::hob::GuidExtension>
Line
Count
Source
57
562k
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
562k
        self.pread_with(offset, Ctx::default())
59
562k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::hob::FirmwareVolume>
Line
Count
Source
57
12.6k
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
12.6k
        self.pread_with(offset, Ctx::default())
59
12.6k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::hob::HandoffInfoTable>
Line
Count
Source
57
10.4k
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
10.4k
        self.pread_with(offset, Ctx::default())
59
10.4k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::hob::MemoryAllocation>
Line
Count
Source
57
21.9k
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
21.9k
        self.pread_with(offset, Ctx::default())
59
21.9k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::hob::ResourceDescription>
Line
Count
Source
57
33.3k
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
33.3k
        self.pread_with(offset, Ctx::default())
59
33.3k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::hob::Cpu>
Line
Count
Source
57
1.85k
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
1.85k
        self.pread_with(offset, Ctx::default())
59
1.85k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim_interface::td_uefi_pi::pi::hob::Header>
Line
Count
Source
57
2.28M
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
2.28M
        self.pread_with(offset, Ctx::default())
59
2.28M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_loader::pe::Section>
Line
Count
Source
57
120k
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
120k
        self.pread_with(offset, Ctx::default())
59
120k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_loader::elf64::ELFHeader64>
Line
Count
Source
57
11.7k
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
11.7k
        self.pread_with(offset, Ctx::default())
59
11.7k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_loader::elf64::ProgramHeader>
Line
Count
Source
57
3.63M
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
3.63M
        self.pread_with(offset, Ctx::default())
59
3.63M
    }
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_loader::elf64::SectionHeader>
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_loader::elf64::Dyn>
Line
Count
Source
57
94.0M
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
94.0M
        self.pread_with(offset, Ctx::default())
59
94.0M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_loader::elf64::Rela>
Line
Count
Source
57
7.53M
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
7.53M
        self.pread_with(offset, Ctx::default())
59
7.53M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<u32>
Line
Count
Source
57
12.6k
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
12.6k
        self.pread_with(offset, Ctx::default())
59
12.6k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<u16>
Line
Count
Source
57
1.69M
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
1.69M
        self.pread_with(offset, Ctx::default())
59
1.69M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<u64>
Line
Count
Source
57
28.4k
    fn pread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a, Ctx: Default {
58
28.4k
        self.pread_with(offset, Ctx::default())
59
28.4k
    }
60
    #[inline]
61
    /// Reads a value from `self` at `offset` with the given `ctx`
62
    /// # Example
63
    /// ```rust
64
    /// use scroll::Pread;
65
    /// let bytes: [u8; 2] = [0xde, 0xad];
66
    /// let dead: u16 = bytes.pread_with(0, scroll::BE).unwrap();
67
    /// assert_eq!(dead, 0xdeadu16);
68
110M
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
110M
        let len = self.measure_with(&ctx);
70
110M
        if offset >= len {
71
168
            return Err(error::Error::BadOffset(offset).into())
72
110M
        }
73
110M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim::secure_boot::PayloadSignHeader>::{closure#0}
Line
Count
Source
73
1.70k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::metadata::TdxMetadataSection>::{closure#0}
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::metadata::TdxMetadataDescriptor>::{closure#0}
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::FfsFileHeader>::{closure#0}
Line
Count
Source
73
12.1k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::FfsFileHeader2>::{closure#0}
Line
Count
Source
73
6.75k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::CommonSectionHeader>::{closure#0}
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::CommonSectionHeader2>::{closure#0}
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::FirmwareVolumeHeader>::{closure#0}
Line
Count
Source
73
1.68k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::GuidExtension>::{closure#0}
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::FirmwareVolume>::{closure#0}
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::HandoffInfoTable>::{closure#0}
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::MemoryAllocation>::{closure#0}
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::ResourceDescription>::{closure#0}
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::Cpu>::{closure#0}
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::Header>::{closure#0}
Unexecuted instantiation: <_ as scroll::pread::Pread<_, _>>::pread_with::<_>::{closure#0}
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::metadata::TdxMetadataSection>::{closure#0}
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::metadata::TdxMetadataDescriptor>::{closure#0}
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::FfsFileHeader>::{closure#0}
Line
Count
Source
73
20.1k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::FfsFileHeader2>::{closure#0}
Line
Count
Source
73
13.6k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::CommonSectionHeader>::{closure#0}
Line
Count
Source
73
1.21k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::CommonSectionHeader2>::{closure#0}
Line
Count
Source
73
507
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::FirmwareVolumeHeader>::{closure#0}
Line
Count
Source
73
2.44k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::GuidExtension>::{closure#0}
Line
Count
Source
73
561k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::FirmwareVolume>::{closure#0}
Line
Count
Source
73
12.6k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::HandoffInfoTable>::{closure#0}
Line
Count
Source
73
10.4k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::MemoryAllocation>::{closure#0}
Line
Count
Source
73
21.9k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::ResourceDescription>::{closure#0}
Line
Count
Source
73
33.3k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::Cpu>::{closure#0}
Line
Count
Source
73
1.85k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::Header>::{closure#0}
Line
Count
Source
73
2.28M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_loader::pe::Section>::{closure#0}
Line
Count
Source
73
120k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_loader::elf64::ELFHeader64>::{closure#0}
Line
Count
Source
73
11.5k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_loader::elf64::ProgramHeader>::{closure#0}
Line
Count
Source
73
3.63M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_loader::elf64::SectionHeader>::{closure#0}
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_loader::elf64::Dyn>::{closure#0}
Line
Count
Source
73
94.0M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_loader::elf64::Rela>::{closure#0}
Line
Count
Source
73
7.53M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<u32>::{closure#0}
Line
Count
Source
73
12.6k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<u16>::{closure#0}
Line
Count
Source
73
1.69M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<u64>::{closure#0}
Line
Count
Source
73
28.2k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
110M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim::secure_boot::PayloadSignHeader>
Line
Count
Source
68
1.76k
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
1.76k
        let len = self.measure_with(&ctx);
70
1.76k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
1.76k
        }
73
1.76k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
1.76k
    }
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::metadata::TdxMetadataSection>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::metadata::TdxMetadataDescriptor>
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::FfsFileHeader>
Line
Count
Source
68
12.2k
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
12.2k
        let len = self.measure_with(&ctx);
70
12.2k
        if offset >= len {
71
21
            return Err(error::Error::BadOffset(offset).into())
72
12.2k
        }
73
12.2k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
12.2k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::FfsFileHeader2>
Line
Count
Source
68
6.76k
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
6.76k
        let len = self.measure_with(&ctx);
70
6.76k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
6.76k
        }
73
6.76k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
6.76k
    }
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::CommonSectionHeader>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::CommonSectionHeader2>
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::FirmwareVolumeHeader>
Line
Count
Source
68
1.76k
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
1.76k
        let len = self.measure_with(&ctx);
70
1.76k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
1.76k
        }
73
1.76k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
1.76k
    }
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::GuidExtension>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::FirmwareVolume>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::HandoffInfoTable>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::MemoryAllocation>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::ResourceDescription>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::Cpu>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::Header>
Unexecuted instantiation: <_ as scroll::pread::Pread<_, _>>::pread_with::<_>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::metadata::TdxMetadataSection>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::metadata::TdxMetadataDescriptor>
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::FfsFileHeader>
Line
Count
Source
68
20.4k
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
20.4k
        let len = self.measure_with(&ctx);
70
20.4k
        if offset >= len {
71
19
            return Err(error::Error::BadOffset(offset).into())
72
20.4k
        }
73
20.4k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
20.4k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::FfsFileHeader2>
Line
Count
Source
68
13.6k
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
13.6k
        let len = self.measure_with(&ctx);
70
13.6k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
13.6k
        }
73
13.6k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
13.6k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::CommonSectionHeader>
Line
Count
Source
68
1.24k
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
1.24k
        let len = self.measure_with(&ctx);
70
1.24k
        if offset >= len {
71
11
            return Err(error::Error::BadOffset(offset).into())
72
1.23k
        }
73
1.23k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
1.24k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::CommonSectionHeader2>
Line
Count
Source
68
515
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
515
        let len = self.measure_with(&ctx);
70
515
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
515
        }
73
515
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
515
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::fv::FirmwareVolumeHeader>
Line
Count
Source
68
2.59k
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
2.59k
        let len = self.measure_with(&ctx);
70
2.59k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
2.59k
        }
73
2.59k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
2.59k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::GuidExtension>
Line
Count
Source
68
562k
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
562k
        let len = self.measure_with(&ctx);
70
562k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
562k
        }
73
562k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
562k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::FirmwareVolume>
Line
Count
Source
68
12.6k
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
12.6k
        let len = self.measure_with(&ctx);
70
12.6k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
12.6k
        }
73
12.6k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
12.6k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::HandoffInfoTable>
Line
Count
Source
68
10.4k
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
10.4k
        let len = self.measure_with(&ctx);
70
10.4k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
10.4k
        }
73
10.4k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
10.4k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::MemoryAllocation>
Line
Count
Source
68
21.9k
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
21.9k
        let len = self.measure_with(&ctx);
70
21.9k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
21.9k
        }
73
21.9k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
21.9k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::ResourceDescription>
Line
Count
Source
68
33.3k
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
33.3k
        let len = self.measure_with(&ctx);
70
33.3k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
33.3k
        }
73
33.3k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
33.3k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::Cpu>
Line
Count
Source
68
1.85k
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
1.85k
        let len = self.measure_with(&ctx);
70
1.85k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
1.85k
        }
73
1.85k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
1.85k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim_interface::td_uefi_pi::pi::hob::Header>
Line
Count
Source
68
2.28M
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
2.28M
        let len = self.measure_with(&ctx);
70
2.28M
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
2.28M
        }
73
2.28M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
2.28M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_loader::pe::Section>
Line
Count
Source
68
120k
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
120k
        let len = self.measure_with(&ctx);
70
120k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
120k
        }
73
120k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
120k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_loader::elf64::ELFHeader64>
Line
Count
Source
68
11.7k
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
11.7k
        let len = self.measure_with(&ctx);
70
11.7k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
11.7k
        }
73
11.7k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
11.7k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_loader::elf64::ProgramHeader>
Line
Count
Source
68
3.63M
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
3.63M
        let len = self.measure_with(&ctx);
70
3.63M
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
3.63M
        }
73
3.63M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
3.63M
    }
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_loader::elf64::SectionHeader>
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_loader::elf64::Dyn>
Line
Count
Source
68
94.0M
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
94.0M
        let len = self.measure_with(&ctx);
70
94.0M
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
94.0M
        }
73
94.0M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
94.0M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_loader::elf64::Rela>
Line
Count
Source
68
7.53M
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
7.53M
        let len = self.measure_with(&ctx);
70
7.53M
        if offset >= len {
71
2
            return Err(error::Error::BadOffset(offset).into())
72
7.53M
        }
73
7.53M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
7.53M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<u32>
Line
Count
Source
68
12.6k
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
12.6k
        let len = self.measure_with(&ctx);
70
12.6k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
12.6k
        }
73
12.6k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
12.6k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<u16>
Line
Count
Source
68
1.69M
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
1.69M
        let len = self.measure_with(&ctx);
70
1.69M
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
1.69M
        }
73
1.69M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
1.69M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<u64>
Line
Count
Source
68
28.4k
    fn pread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: usize, ctx: Ctx) -> result::Result<N, E> where <Self as Index<RangeFrom<usize>>>::Output: 'a {
69
28.4k
        let len = self.measure_with(&ctx);
70
28.4k
        if offset >= len {
71
115
            return Err(error::Error::BadOffset(offset).into())
72
28.2k
        }
73
28.2k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
28.4k
    }
75
    #[inline]
76
    /// Reads a value from `self` at `offset` with a default `Ctx`. For the primitive numeric values, this will read at the machine's endianness. Updates the offset
77
    /// # Example
78
    /// ```rust
79
    /// use scroll::Pread;
80
    /// let offset = &mut 0;
81
    /// let bytes = [0x7fu8; 0x01];
82
    /// let byte = bytes.gread::<u8>(offset).unwrap();
83
    /// assert_eq!(*offset, 1);
84
0
    fn gread<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>(&'a self, offset: &mut usize) -> result::Result<N, E> where Ctx: Default, <Self as Index<RangeFrom<usize>>>::Output: 'a {
85
0
        let ctx = Ctx::default();
86
0
        self.gread_with(offset, ctx)
87
0
    }
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread::<td_shim::secure_boot::CfvPubKeyFileHeader>
Unexecuted instantiation: <_ as scroll::pread::Pread<_, _>>::gread::<_>
88
    /// Reads a value from `self` at `offset` with the given `ctx`, and updates the offset.
89
    /// # Example
90
    /// ```rust
91
    /// use scroll::Pread;
92
    /// let offset = &mut 0;
93
    /// let bytes: [u8; 2] = [0xde, 0xad];
94
    /// let dead: u16 = bytes.gread_with(offset, scroll::BE).unwrap();
95
    /// assert_eq!(dead, 0xdeadu16);
96
    /// assert_eq!(*offset, 2);
97
    #[inline]
98
263M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
263M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
263M
        result::Result<N, E>
101
263M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
263M
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
263M
        let len = self.measure_with(&ctx);
109
263M
        if o >= len {
110
2.54k
            return Err(error::Error::BadOffset(o).into())
111
263M
        }
112
263M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
263M
            *offset += size;
114
263M
            Ok(n)
115
263M
        })
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<td_shim::secure_boot::CfvPubKeyFileHeader>::{closure#0}
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<td_shim_interface::td_uefi_pi::pi::fv::Checksum>::{closure#0}
Line
Count
Source
112
18.8k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
18.8k
            *offset += size;
114
18.8k
            Ok(n)
115
18.8k
        })
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<td_shim_interface::td_uefi_pi::pi::hob::MemoryAllocationHeader>::{closure#0}
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<td_shim_interface::td_uefi_pi::pi::hob::Header>::{closure#0}
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u8>::{closure#0}
Line
Count
Source
112
540k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
540k
            *offset += size;
114
540k
            Ok(n)
115
540k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u32>::{closure#0}
Line
Count
Source
112
17.0k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
17.0k
            *offset += size;
114
17.0k
            Ok(n)
115
17.0k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u16>::{closure#0}
Line
Count
Source
112
5.05k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
5.05k
            *offset += size;
114
5.05k
            Ok(n)
115
5.05k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u64>::{closure#0}
Line
Count
Source
112
5.12k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
5.12k
            *offset += size;
114
5.12k
            Ok(n)
115
5.12k
        })
Unexecuted instantiation: <_ as scroll::pread::Pread<_, _>>::gread_with::<_>::{closure#0}
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<td_shim_interface::td_uefi_pi::pi::fv::Checksum>::{closure#0}
Line
Count
Source
112
33.9k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
33.9k
            *offset += size;
114
33.9k
            Ok(n)
115
33.9k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<td_shim_interface::td_uefi_pi::pi::hob::MemoryAllocationHeader>::{closure#0}
Line
Count
Source
112
21.9k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
21.9k
            *offset += size;
114
21.9k
            Ok(n)
115
21.9k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<td_shim_interface::td_uefi_pi::pi::hob::Header>::{closure#0}
Line
Count
Source
112
642k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
642k
            *offset += size;
114
642k
            Ok(n)
115
642k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u8>::{closure#0}
Line
Count
Source
112
10.8M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
10.8M
            *offset += size;
114
10.8M
            Ok(n)
115
10.8M
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u32>::{closure#0}
Line
Count
Source
112
3.05M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
3.05M
            *offset += size;
114
3.05M
            Ok(n)
115
3.05M
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u16>::{closure#0}
Line
Count
Source
112
5.86M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
5.86M
            *offset += size;
114
5.86M
            Ok(n)
115
5.86M
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u64>::{closure#0}
Line
Count
Source
112
190k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
190k
            *offset += size;
114
190k
            Ok(n)
115
190k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u8>::{closure#0}
Line
Count
Source
112
1.14M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
1.14M
            *offset += size;
114
1.14M
            Ok(n)
115
1.14M
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u32>::{closure#0}
Line
Count
Source
112
8.13M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
8.13M
            *offset += size;
114
8.13M
            Ok(n)
115
8.13M
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u16>::{closure#0}
Line
Count
Source
112
333k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
333k
            *offset += size;
114
333k
            Ok(n)
115
333k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<i64>::{closure#0}
Line
Count
Source
112
7.53M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
7.53M
            *offset += size;
114
7.53M
            Ok(n)
115
7.53M
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u64>::{closure#0}
Line
Count
Source
112
224M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
224M
            *offset += size;
114
224M
            Ok(n)
115
224M
        })
116
263M
    }
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<td_shim::secure_boot::CfvPubKeyFileHeader>
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<td_shim_interface::td_uefi_pi::pi::fv::Checksum>
Line
Count
Source
98
18.9k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
18.9k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
18.9k
        result::Result<N, E>
101
18.9k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
18.9k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
18.9k
        let len = self.measure_with(&ctx);
109
18.9k
        if o >= len {
110
9
            return Err(error::Error::BadOffset(o).into())
111
18.8k
        }
112
18.8k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
18.9k
    }
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<td_shim_interface::td_uefi_pi::pi::hob::MemoryAllocationHeader>
Unexecuted instantiation: <[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<td_shim_interface::td_uefi_pi::pi::hob::Header>
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u8>
Line
Count
Source
98
540k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
540k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
540k
        result::Result<N, E>
101
540k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
540k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
540k
        let len = self.measure_with(&ctx);
109
540k
        if o >= len {
110
202
            return Err(error::Error::BadOffset(o).into())
111
540k
        }
112
540k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
540k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u32>
Line
Count
Source
98
17.0k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
17.0k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
17.0k
        result::Result<N, E>
101
17.0k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
17.0k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
17.0k
        let len = self.measure_with(&ctx);
109
17.0k
        if o >= len {
110
11
            return Err(error::Error::BadOffset(o).into())
111
17.0k
        }
112
17.0k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
17.0k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u16>
Line
Count
Source
98
5.06k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
5.06k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
5.06k
        result::Result<N, E>
101
5.06k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
5.06k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
5.06k
        let len = self.measure_with(&ctx);
109
5.06k
        if o >= len {
110
3
            return Err(error::Error::BadOffset(o).into())
111
5.05k
        }
112
5.05k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
5.06k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u64>
Line
Count
Source
98
5.14k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
5.14k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
5.14k
        result::Result<N, E>
101
5.14k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
5.14k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
5.14k
        let len = self.measure_with(&ctx);
109
5.14k
        if o >= len {
110
3
            return Err(error::Error::BadOffset(o).into())
111
5.14k
        }
112
5.14k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
5.14k
    }
Unexecuted instantiation: <_ as scroll::pread::Pread<_, _>>::gread_with::<_>
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<td_shim_interface::td_uefi_pi::pi::fv::Checksum>
Line
Count
Source
98
33.9k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
33.9k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
33.9k
        result::Result<N, E>
101
33.9k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
33.9k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
33.9k
        let len = self.measure_with(&ctx);
109
33.9k
        if o >= len {
110
19
            return Err(error::Error::BadOffset(o).into())
111
33.9k
        }
112
33.9k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
33.9k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<td_shim_interface::td_uefi_pi::pi::hob::MemoryAllocationHeader>
Line
Count
Source
98
21.9k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
21.9k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
21.9k
        result::Result<N, E>
101
21.9k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
21.9k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
21.9k
        let len = self.measure_with(&ctx);
109
21.9k
        if o >= len {
110
0
            return Err(error::Error::BadOffset(o).into())
111
21.9k
        }
112
21.9k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
21.9k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<td_shim_interface::td_uefi_pi::pi::hob::Header>
Line
Count
Source
98
642k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
642k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
642k
        result::Result<N, E>
101
642k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
642k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
642k
        let len = self.measure_with(&ctx);
109
642k
        if o >= len {
110
0
            return Err(error::Error::BadOffset(o).into())
111
642k
        }
112
642k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
642k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u8>
Line
Count
Source
98
10.8M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
10.8M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
10.8M
        result::Result<N, E>
101
10.8M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
10.8M
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
10.8M
        let len = self.measure_with(&ctx);
109
10.8M
        if o >= len {
110
675
            return Err(error::Error::BadOffset(o).into())
111
10.8M
        }
112
10.8M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
10.8M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u32>
Line
Count
Source
98
3.05M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
3.05M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
3.05M
        result::Result<N, E>
101
3.05M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
3.05M
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
3.05M
        let len = self.measure_with(&ctx);
109
3.05M
        if o >= len {
110
16
            return Err(error::Error::BadOffset(o).into())
111
3.05M
        }
112
3.05M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
3.05M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u16>
Line
Count
Source
98
5.86M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
5.86M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
5.86M
        result::Result<N, E>
101
5.86M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
5.86M
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
5.86M
        let len = self.measure_with(&ctx);
109
5.86M
        if o >= len {
110
6
            return Err(error::Error::BadOffset(o).into())
111
5.86M
        }
112
5.86M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
5.86M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u64>
Line
Count
Source
98
190k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
190k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
190k
        result::Result<N, E>
101
190k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
190k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
190k
        let len = self.measure_with(&ctx);
109
190k
        if o >= len {
110
2
            return Err(error::Error::BadOffset(o).into())
111
190k
        }
112
190k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
190k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u8>
Line
Count
Source
98
1.14M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
1.14M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
1.14M
        result::Result<N, E>
101
1.14M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
1.14M
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
1.14M
        let len = self.measure_with(&ctx);
109
1.14M
        if o >= len {
110
46
            return Err(error::Error::BadOffset(o).into())
111
1.14M
        }
112
1.14M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
1.14M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u32>
Line
Count
Source
98
8.13M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
8.13M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
8.13M
        result::Result<N, E>
101
8.13M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
8.13M
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
8.13M
        let len = self.measure_with(&ctx);
109
8.13M
        if o >= len {
110
104
            return Err(error::Error::BadOffset(o).into())
111
8.13M
        }
112
8.13M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
8.13M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u16>
Line
Count
Source
98
333k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
333k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
333k
        result::Result<N, E>
101
333k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
333k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
333k
        let len = self.measure_with(&ctx);
109
333k
        if o >= len {
110
16
            return Err(error::Error::BadOffset(o).into())
111
333k
        }
112
333k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
333k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<i64>
Line
Count
Source
98
7.53M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
7.53M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
7.53M
        result::Result<N, E>
101
7.53M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
7.53M
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
7.53M
        let len = self.measure_with(&ctx);
109
7.53M
        if o >= len {
110
9
            return Err(error::Error::BadOffset(o).into())
111
7.53M
        }
112
7.53M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
7.53M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u64>
Line
Count
Source
98
224M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
224M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
224M
        result::Result<N, E>
101
224M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
224M
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
224M
        let len = self.measure_with(&ctx);
109
224M
        if o >= len {
110
1.42k
            return Err(error::Error::BadOffset(o).into())
111
224M
        }
112
224M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
224M
    }
117
118
    /// Trys to write `inout.len()` `N`s into `inout` from `Self` starting at `offset`, using the default context for `N`, and updates the offset.
119
    /// # Example
120
    /// ```rust
121
    /// use scroll::Pread;
122
    /// let mut bytes: Vec<u8> = vec![0, 0];
123
    /// let offset = &mut 0;
124
    /// let bytes_from: [u8; 2] = [0x48, 0x49];
125
    /// bytes_from.gread_inout(offset, &mut bytes).unwrap();
126
    /// assert_eq!(&bytes, &bytes_from);
127
    /// assert_eq!(*offset, 2);
128
    #[inline]
129
0
    fn gread_inout<'a, N>(&'a self, offset: &mut usize, inout: &mut [N]) -> result::Result<(), E>
130
0
        where
131
0
        N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>,
132
0
    Ctx: Default,
133
0
    <Self as Index<RangeFrom<usize>>>::Output: 'a
134
    {
135
0
        for i in inout.iter_mut() {
136
0
            *i = self.gread(offset)?;
137
        }
138
0
        Ok(())
139
0
    }
140
141
    /// Trys to write `inout.len()` `N`s into `inout` from `Self` starting at `offset`, using the context `ctx`
142
    /// # Example
143
    /// ```rust
144
    /// use scroll::{ctx, LE, Pread};
145
    /// let mut bytes: Vec<u8> = vec![0, 0];
146
    /// let offset = &mut 0;
147
    /// let bytes_from: [u8; 2] = [0x48, 0x49];
148
    /// bytes_from.gread_inout_with(offset, &mut bytes, LE).unwrap();
149
    /// assert_eq!(&bytes, &bytes_from);
150
    /// assert_eq!(*offset, 2);
151
    #[inline]
152
891k
    fn gread_inout_with<'a, N>(&'a self, offset: &mut usize, inout: &mut [N], ctx: Ctx) -> result::Result<(), E>
153
891k
        where
154
891k
        N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>,
155
891k
    <Self as Index<RangeFrom<usize>>>::Output: 'a
156
    {
157
12.3M
        for i in inout.iter_mut() {
158
12.3M
            *i = self.gread_with(offset, ctx)?;
159
        }
160
890k
        Ok(())
161
891k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_inout_with::<u8>
Line
Count
Source
152
43.1k
    fn gread_inout_with<'a, N>(&'a self, offset: &mut usize, inout: &mut [N], ctx: Ctx) -> result::Result<(), E>
153
43.1k
        where
154
43.1k
        N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>,
155
43.1k
    <Self as Index<RangeFrom<usize>>>::Output: 'a
156
    {
157
442k
        for i in inout.iter_mut() {
158
442k
            *i = self.gread_with(offset, ctx)?;
159
        }
160
42.9k
        Ok(())
161
43.1k
    }
Unexecuted instantiation: <_ as scroll::pread::Pread<_, _>>::gread_inout_with::<_>
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_inout_with::<u8>
Line
Count
Source
152
716k
    fn gread_inout_with<'a, N>(&'a self, offset: &mut usize, inout: &mut [N], ctx: Ctx) -> result::Result<(), E>
153
716k
        where
154
716k
        N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>,
155
716k
    <Self as Index<RangeFrom<usize>>>::Output: 'a
156
    {
157
10.7M
        for i in inout.iter_mut() {
158
10.7M
            *i = self.gread_with(offset, ctx)?;
159
        }
160
715k
        Ok(())
161
716k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_inout_with::<u8>
Line
Count
Source
152
131k
    fn gread_inout_with<'a, N>(&'a self, offset: &mut usize, inout: &mut [N], ctx: Ctx) -> result::Result<(), E>
153
131k
        where
154
131k
        N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>,
155
131k
    <Self as Index<RangeFrom<usize>>>::Output: 'a
156
    {
157
1.14M
        for i in inout.iter_mut() {
158
1.14M
            *i = self.gread_with(offset, ctx)?;
159
        }
160
131k
        Ok(())
161
131k
    }
162
}
163
164
impl<Ctx: Copy,
165
     E: From<error::Error>,
166
     R: ?Sized + Index<usize> + Index<RangeFrom<usize>> + MeasureWith<Ctx>>
167
    Pread<Ctx, E> for R {}