Coverage Report

Created: 2025-10-10 06:38

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
70.1M
    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
70.1M
        self.pread_with(offset, Ctx::default())
59
70.1M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_shim::secure_boot::PayloadSignHeader>
Line
Count
Source
57
1.70k
    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.70k
        self.pread_with(offset, Ctx::default())
59
1.70k
    }
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
10.5k
    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.5k
        self.pread_with(offset, Ctx::default())
59
10.5k
    }
<[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
5.90k
    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
5.90k
        self.pread_with(offset, Ctx::default())
59
5.90k
    }
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.70k
    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.70k
        self.pread_with(offset, Ctx::default())
59
1.70k
    }
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
15.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
15.7k
        self.pread_with(offset, Ctx::default())
59
15.7k
    }
<[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
10.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
10.2k
        self.pread_with(offset, Ctx::default())
59
10.2k
    }
<[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.33k
    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.33k
        self.pread_with(offset, Ctx::default())
59
1.33k
    }
<[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
502
    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
502
        self.pread_with(offset, Ctx::default())
59
502
    }
<[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.50k
    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.50k
        self.pread_with(offset, Ctx::default())
59
2.50k
    }
<[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
533k
    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
533k
        self.pread_with(offset, Ctx::default())
59
533k
    }
<[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
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::HandoffInfoTable>
Line
Count
Source
57
8.40k
    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
8.40k
        self.pread_with(offset, Ctx::default())
59
8.40k
    }
<[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
20.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
20.2k
        self.pread_with(offset, Ctx::default())
59
20.2k
    }
<[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
28.5k
    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.5k
        self.pread_with(offset, Ctx::default())
59
28.5k
    }
<[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
5.51k
    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
5.51k
        self.pread_with(offset, Ctx::default())
59
5.51k
    }
<[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.17M
    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.17M
        self.pread_with(offset, Ctx::default())
59
2.17M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_loader::pe::Section>
Line
Count
Source
57
22.1k
    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
22.1k
        self.pread_with(offset, Ctx::default())
59
22.1k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_loader::elf64::ELFHeader64>
Line
Count
Source
57
10.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
10.9k
        self.pread_with(offset, Ctx::default())
59
10.9k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_loader::elf64::ProgramHeader>
Line
Count
Source
57
3.98M
    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.98M
        self.pread_with(offset, Ctx::default())
59
3.98M
    }
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
47.4M
    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
47.4M
        self.pread_with(offset, Ctx::default())
59
47.4M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_loader::elf64::Rela>
Line
Count
Source
57
13.4M
    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.4M
        self.pread_with(offset, Ctx::default())
59
13.4M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<u32>
Line
Count
Source
57
13.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
13.4k
        self.pread_with(offset, Ctx::default())
59
13.4k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<u16>
Line
Count
Source
57
2.37M
    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.37M
        self.pread_with(offset, Ctx::default())
59
2.37M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<u64>
Line
Count
Source
57
37.0k
    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
37.0k
        self.pread_with(offset, Ctx::default())
59
37.0k
    }
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
70.1M
    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
70.1M
        let len = self.measure_with(&ctx);
70
70.1M
        if offset >= len {
71
198
            return Err(error::Error::BadOffset(offset).into())
72
70.1M
        }
73
70.1M
        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.64k
        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
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::fv::FfsFileHeader2>::{closure#0}
Line
Count
Source
73
5.89k
        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.63k
        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
15.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_shim_interface::td_uefi_pi::pi::fv::FfsFileHeader2>::{closure#0}
Line
Count
Source
73
10.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::CommonSectionHeader>::{closure#0}
Line
Count
Source
73
1.32k
        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
489
        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.37k
        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
533k
        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
2.59k
        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
8.40k
        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
20.2k
        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
28.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_shim_interface::td_uefi_pi::pi::hob::Cpu>::{closure#0}
Line
Count
Source
73
5.51k
        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.17M
        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
22.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_loader::elf64::ELFHeader64>::{closure#0}
Line
Count
Source
73
10.8k
        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.98M
        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
47.4M
        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
13.4M
        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
13.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::<u16>::{closure#0}
Line
Count
Source
73
2.37M
        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
36.8k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
70.1M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_shim::secure_boot::PayloadSignHeader>
Line
Count
Source
68
1.70k
    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.70k
        let len = self.measure_with(&ctx);
70
1.70k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
1.70k
        }
73
1.70k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
1.70k
    }
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
10.5k
    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.5k
        let len = self.measure_with(&ctx);
70
10.5k
        if offset >= len {
71
17
            return Err(error::Error::BadOffset(offset).into())
72
10.5k
        }
73
10.5k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
10.5k
    }
<[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
5.90k
    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
5.90k
        let len = self.measure_with(&ctx);
70
5.90k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
5.90k
        }
73
5.90k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
5.90k
    }
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.70k
    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.70k
        let len = self.measure_with(&ctx);
70
1.70k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
1.70k
        }
73
1.70k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
1.70k
    }
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
15.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
15.7k
        let len = self.measure_with(&ctx);
70
15.7k
        if offset >= len {
71
17
            return Err(error::Error::BadOffset(offset).into())
72
15.7k
        }
73
15.7k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
15.7k
    }
<[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
10.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
10.2k
        let len = self.measure_with(&ctx);
70
10.2k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
10.2k
        }
73
10.2k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
10.2k
    }
<[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.33k
    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.33k
        let len = self.measure_with(&ctx);
70
1.33k
        if offset >= len {
71
9
            return Err(error::Error::BadOffset(offset).into())
72
1.33k
        }
73
1.33k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
1.33k
    }
<[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
502
    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
502
        let len = self.measure_with(&ctx);
70
502
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
502
        }
73
502
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
502
    }
<[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.50k
    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.50k
        let len = self.measure_with(&ctx);
70
2.50k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
2.50k
        }
73
2.50k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
2.50k
    }
<[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
533k
    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
533k
        let len = self.measure_with(&ctx);
70
533k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
533k
        }
73
533k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
533k
    }
<[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
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::HandoffInfoTable>
Line
Count
Source
68
8.40k
    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
8.40k
        let len = self.measure_with(&ctx);
70
8.40k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
8.40k
        }
73
8.40k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
8.40k
    }
<[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
20.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
20.2k
        let len = self.measure_with(&ctx);
70
20.2k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
20.2k
        }
73
20.2k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
20.2k
    }
<[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
28.5k
    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.5k
        let len = self.measure_with(&ctx);
70
28.5k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
28.5k
        }
73
28.5k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
28.5k
    }
<[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
5.51k
    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
5.51k
        let len = self.measure_with(&ctx);
70
5.51k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
5.51k
        }
73
5.51k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
5.51k
    }
<[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.17M
    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.17M
        let len = self.measure_with(&ctx);
70
2.17M
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
2.17M
        }
73
2.17M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
2.17M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_loader::pe::Section>
Line
Count
Source
68
22.1k
    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
22.1k
        let len = self.measure_with(&ctx);
70
22.1k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
22.1k
        }
73
22.1k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
22.1k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_loader::elf64::ELFHeader64>
Line
Count
Source
68
10.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
10.9k
        let len = self.measure_with(&ctx);
70
10.9k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
10.9k
        }
73
10.9k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
10.9k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_loader::elf64::ProgramHeader>
Line
Count
Source
68
3.98M
    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.98M
        let len = self.measure_with(&ctx);
70
3.98M
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
3.98M
        }
73
3.98M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
3.98M
    }
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
47.4M
    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
47.4M
        let len = self.measure_with(&ctx);
70
47.4M
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
47.4M
        }
73
47.4M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
47.4M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_loader::elf64::Rela>
Line
Count
Source
68
13.4M
    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.4M
        let len = self.measure_with(&ctx);
70
13.4M
        if offset >= len {
71
2
            return Err(error::Error::BadOffset(offset).into())
72
13.4M
        }
73
13.4M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
13.4M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<u32>
Line
Count
Source
68
13.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
13.4k
        let len = self.measure_with(&ctx);
70
13.4k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
13.4k
        }
73
13.4k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
13.4k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<u16>
Line
Count
Source
68
2.37M
    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.37M
        let len = self.measure_with(&ctx);
70
2.37M
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
2.37M
        }
73
2.37M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
2.37M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<u64>
Line
Count
Source
68
37.0k
    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
37.0k
        let len = self.measure_with(&ctx);
70
37.0k
        if offset >= len {
71
153
            return Err(error::Error::BadOffset(offset).into())
72
36.9k
        }
73
36.9k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
37.0k
    }
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
187M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
187M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
187M
        result::Result<N, E>
101
187M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
187M
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
187M
        let len = self.measure_with(&ctx);
109
187M
        if o >= len {
110
2.37k
            return Err(error::Error::BadOffset(o).into())
111
187M
        }
112
187M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
187M
            *offset += size;
114
187M
            Ok(n)
115
187M
        })
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
16.3k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
16.3k
            *offset += size;
114
16.3k
            Ok(n)
115
16.3k
        })
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
477k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
477k
            *offset += size;
114
477k
            Ok(n)
115
477k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u32>::{closure#0}
Line
Count
Source
112
15.8k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
15.8k
            *offset += size;
114
15.8k
            Ok(n)
115
15.8k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u16>::{closure#0}
Line
Count
Source
112
4.92k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
4.92k
            *offset += size;
114
4.92k
            Ok(n)
115
4.92k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u64>::{closure#0}
Line
Count
Source
112
4.96k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
4.96k
            *offset += size;
114
4.96k
            Ok(n)
115
4.96k
        })
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
25.7k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
25.7k
            *offset += size;
114
25.7k
            Ok(n)
115
25.7k
        })
<[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
20.2k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
20.2k
            *offset += size;
114
20.2k
            Ok(n)
115
20.2k
        })
<[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
599k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
599k
            *offset += size;
114
599k
            Ok(n)
115
599k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u8>::{closure#0}
Line
Count
Source
112
10.1M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
10.1M
            *offset += size;
114
10.1M
            Ok(n)
115
10.1M
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u32>::{closure#0}
Line
Count
Source
112
2.88M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
2.88M
            *offset += size;
114
2.88M
            Ok(n)
115
2.88M
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u16>::{closure#0}
Line
Count
Source
112
5.55M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
5.55M
            *offset += size;
114
5.55M
            Ok(n)
115
5.55M
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u64>::{closure#0}
Line
Count
Source
112
147k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
147k
            *offset += size;
114
147k
            Ok(n)
115
147k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u8>::{closure#0}
Line
Count
Source
112
352k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
352k
            *offset += size;
114
352k
            Ok(n)
115
352k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u32>::{closure#0}
Line
Count
Source
112
8.14M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
8.14M
            *offset += size;
114
8.14M
            Ok(n)
115
8.14M
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u16>::{closure#0}
Line
Count
Source
112
131k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
131k
            *offset += size;
114
131k
            Ok(n)
115
131k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<i64>::{closure#0}
Line
Count
Source
112
13.4M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
13.4M
            *offset += size;
114
13.4M
            Ok(n)
115
13.4M
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u64>::{closure#0}
Line
Count
Source
112
145M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
145M
            *offset += size;
114
145M
            Ok(n)
115
145M
        })
116
187M
    }
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
16.3k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
16.3k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
16.3k
        result::Result<N, E>
101
16.3k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
16.3k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
16.3k
        let len = self.measure_with(&ctx);
109
16.3k
        if o >= len {
110
9
            return Err(error::Error::BadOffset(o).into())
111
16.3k
        }
112
16.3k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
16.3k
    }
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
477k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
477k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
477k
        result::Result<N, E>
101
477k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
477k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
477k
        let len = self.measure_with(&ctx);
109
477k
        if o >= len {
110
186
            return Err(error::Error::BadOffset(o).into())
111
477k
        }
112
477k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
477k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u32>
Line
Count
Source
98
15.8k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
15.8k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
15.8k
        result::Result<N, E>
101
15.8k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
15.8k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
15.8k
        let len = self.measure_with(&ctx);
109
15.8k
        if o >= len {
110
12
            return Err(error::Error::BadOffset(o).into())
111
15.8k
        }
112
15.8k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
15.8k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u16>
Line
Count
Source
98
4.92k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
4.92k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
4.92k
        result::Result<N, E>
101
4.92k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
4.92k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
4.92k
        let len = self.measure_with(&ctx);
109
4.92k
        if o >= len {
110
3
            return Err(error::Error::BadOffset(o).into())
111
4.92k
        }
112
4.92k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
4.92k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u64>
Line
Count
Source
98
4.99k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
4.99k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
4.99k
        result::Result<N, E>
101
4.99k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
4.99k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
4.99k
        let len = self.measure_with(&ctx);
109
4.99k
        if o >= len {
110
3
            return Err(error::Error::BadOffset(o).into())
111
4.98k
        }
112
4.98k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
4.99k
    }
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
25.8k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
25.8k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
25.8k
        result::Result<N, E>
101
25.8k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
25.8k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
25.8k
        let len = self.measure_with(&ctx);
109
25.8k
        if o >= len {
110
19
            return Err(error::Error::BadOffset(o).into())
111
25.7k
        }
112
25.7k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
25.8k
    }
<[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
20.2k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
20.2k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
20.2k
        result::Result<N, E>
101
20.2k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
20.2k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
20.2k
        let len = self.measure_with(&ctx);
109
20.2k
        if o >= len {
110
0
            return Err(error::Error::BadOffset(o).into())
111
20.2k
        }
112
20.2k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
20.2k
    }
<[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
599k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
599k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
599k
        result::Result<N, E>
101
599k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
599k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
599k
        let len = self.measure_with(&ctx);
109
599k
        if o >= len {
110
0
            return Err(error::Error::BadOffset(o).into())
111
599k
        }
112
599k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
599k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u8>
Line
Count
Source
98
10.1M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
10.1M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
10.1M
        result::Result<N, E>
101
10.1M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
10.1M
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
10.1M
        let len = self.measure_with(&ctx);
109
10.1M
        if o >= len {
110
632
            return Err(error::Error::BadOffset(o).into())
111
10.1M
        }
112
10.1M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
10.1M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u32>
Line
Count
Source
98
2.88M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
2.88M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
2.88M
        result::Result<N, E>
101
2.88M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
2.88M
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
2.88M
        let len = self.measure_with(&ctx);
109
2.88M
        if o >= len {
110
20
            return Err(error::Error::BadOffset(o).into())
111
2.88M
        }
112
2.88M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
2.88M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u16>
Line
Count
Source
98
5.55M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
5.55M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
5.55M
        result::Result<N, E>
101
5.55M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
5.55M
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
5.55M
        let len = self.measure_with(&ctx);
109
5.55M
        if o >= len {
110
7
            return Err(error::Error::BadOffset(o).into())
111
5.55M
        }
112
5.55M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
5.55M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u64>
Line
Count
Source
98
147k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
147k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
147k
        result::Result<N, E>
101
147k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
147k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
147k
        let len = self.measure_with(&ctx);
109
147k
        if o >= len {
110
2
            return Err(error::Error::BadOffset(o).into())
111
147k
        }
112
147k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
147k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u8>
Line
Count
Source
98
352k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
352k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
352k
        result::Result<N, E>
101
352k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
352k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
352k
        let len = self.measure_with(&ctx);
109
352k
        if o >= len {
110
32
            return Err(error::Error::BadOffset(o).into())
111
352k
        }
112
352k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
352k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u32>
Line
Count
Source
98
8.14M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
8.14M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
8.14M
        result::Result<N, E>
101
8.14M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
8.14M
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
8.14M
        let len = self.measure_with(&ctx);
109
8.14M
        if o >= len {
110
110
            return Err(error::Error::BadOffset(o).into())
111
8.14M
        }
112
8.14M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
8.14M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u16>
Line
Count
Source
98
131k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
131k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
131k
        result::Result<N, E>
101
131k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
131k
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
131k
        let len = self.measure_with(&ctx);
109
131k
        if o >= len {
110
18
            return Err(error::Error::BadOffset(o).into())
111
131k
        }
112
131k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
131k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<i64>
Line
Count
Source
98
13.4M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
13.4M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
13.4M
        result::Result<N, E>
101
13.4M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
13.4M
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
13.4M
        let len = self.measure_with(&ctx);
109
13.4M
        if o >= len {
110
10
            return Err(error::Error::BadOffset(o).into())
111
13.4M
        }
112
13.4M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
13.4M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u64>
Line
Count
Source
98
145M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
145M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
145M
        result::Result<N, E>
101
145M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
    {
103
145M
        let o = *offset;
104
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
        //     *offset += size;
106
        //     Ok(n)
107
        // })
108
145M
        let len = self.measure_with(&ctx);
109
145M
        if o >= len {
110
1.31k
            return Err(error::Error::BadOffset(o).into())
111
145M
        }
112
145M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
        })
116
145M
    }
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
737k
    fn gread_inout_with<'a, N>(&'a self, offset: &mut usize, inout: &mut [N], ctx: Ctx) -> result::Result<(), E>
153
737k
        where
154
737k
        N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>,
155
737k
    <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
737k
        Ok(())
161
737k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_inout_with::<u8>
Line
Count
Source
152
37.8k
    fn gread_inout_with<'a, N>(&'a self, offset: &mut usize, inout: &mut [N], ctx: Ctx) -> result::Result<(), E>
153
37.8k
        where
154
37.8k
        N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>,
155
37.8k
    <Self as Index<RangeFrom<usize>>>::Output: 'a
156
    {
157
392k
        for i in inout.iter_mut() {
158
392k
            *i = self.gread_with(offset, ctx)?;
159
        }
160
37.7k
        Ok(())
161
37.8k
    }
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
667k
    fn gread_inout_with<'a, N>(&'a self, offset: &mut usize, inout: &mut [N], ctx: Ctx) -> result::Result<(), E>
153
667k
        where
154
667k
        N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>,
155
667k
    <Self as Index<RangeFrom<usize>>>::Output: 'a
156
    {
157
10.0M
        for i in inout.iter_mut() {
158
10.0M
            *i = self.gread_with(offset, ctx)?;
159
        }
160
666k
        Ok(())
161
667k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_inout_with::<u8>
Line
Count
Source
152
33.0k
    fn gread_inout_with<'a, N>(&'a self, offset: &mut usize, inout: &mut [N], ctx: Ctx) -> result::Result<(), E>
153
33.0k
        where
154
33.0k
        N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>,
155
33.0k
    <Self as Index<RangeFrom<usize>>>::Output: 'a
156
    {
157
352k
        for i in inout.iter_mut() {
158
352k
            *i = self.gread_with(offset, ctx)?;
159
        }
160
33.0k
        Ok(())
161
33.0k
    }
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 {}