Coverage Report

Created: 2025-07-18 06:08

/rust/registry/src/index.crates.io-6f17d22bba15001f/scroll-0.10.2/src/pread.rs
Line
Count
Source (jump to first uncovered line)
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
55.8M
    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
55.8M
        self.pread_with(offset, Ctx::default())
59
55.8M
    }
<[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
11.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
11.1k
        self.pread_with(offset, Ctx::default())
59
11.1k
    }
<[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.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
5.70k
        self.pread_with(offset, Ctx::default())
59
5.70k
    }
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
19.8k
    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
19.8k
        self.pread_with(offset, Ctx::default())
59
19.8k
    }
<[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.8k
    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.8k
        self.pread_with(offset, Ctx::default())
59
13.8k
    }
<[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.30k
    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.30k
        self.pread_with(offset, Ctx::default())
59
1.30k
    }
<[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
513
    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
513
        self.pread_with(offset, Ctx::default())
59
513
    }
<[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.57k
    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.57k
        self.pread_with(offset, Ctx::default())
59
2.57k
    }
<[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
436k
    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
436k
        self.pread_with(offset, Ctx::default())
59
436k
    }
<[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
4.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
4.90k
        self.pread_with(offset, Ctx::default())
59
4.90k
    }
<[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.74k
    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.74k
        self.pread_with(offset, Ctx::default())
59
8.74k
    }
<[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
16.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
16.5k
        self.pread_with(offset, Ctx::default())
59
16.5k
    }
<[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
22.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
22.9k
        self.pread_with(offset, Ctx::default())
59
22.9k
    }
<[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
3.86k
    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.86k
        self.pread_with(offset, Ctx::default())
59
3.86k
    }
<[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
1.76M
    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.76M
        self.pread_with(offset, Ctx::default())
59
1.76M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_loader::pe::Section>
Line
Count
Source
57
15.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
15.0k
        self.pread_with(offset, Ctx::default())
59
15.0k
    }
<[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
4.33M
    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
4.33M
        self.pread_with(offset, Ctx::default())
59
4.33M
    }
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
43.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
43.0M
        self.pread_with(offset, Ctx::default())
59
43.0M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<td_loader::elf64::Rela>
Line
Count
Source
57
4.16M
    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
4.16M
        self.pread_with(offset, Ctx::default())
59
4.16M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<u32>
Line
Count
Source
57
12.8k
    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.8k
        self.pread_with(offset, Ctx::default())
59
12.8k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<u16>
Line
Count
Source
57
1.96M
    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.96M
        self.pread_with(offset, Ctx::default())
59
1.96M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread::<u64>
Line
Count
Source
57
30.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
30.4k
        self.pread_with(offset, Ctx::default())
59
30.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
55.8M
    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
55.8M
        let len = self.measure_with(&ctx);
70
55.8M
        if offset >= len {
71
243
            return Err(error::Error::BadOffset(offset).into())
72
55.8M
        }
73
55.8M
        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.65k
        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.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::fv::FfsFileHeader2>::{closure#0}
Line
Count
Source
73
5.69k
        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.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::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
19.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
13.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_shim_interface::td_uefi_pi::pi::fv::CommonSectionHeader>::{closure#0}
Line
Count
Source
73
1.28k
        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
504
        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.45k
        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
436k
        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
4.90k
        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.74k
        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
16.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::ResourceDescription>::{closure#0}
Line
Count
Source
73
22.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::Cpu>::{closure#0}
Line
Count
Source
73
3.86k
        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
1.76M
        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
15.0k
        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
4.33M
        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
43.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
4.16M
        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.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::<u16>::{closure#0}
Line
Count
Source
73
1.96M
        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
30.2k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
55.8M
    }
<[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
11.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
11.1k
        let len = self.measure_with(&ctx);
70
11.1k
        if offset >= len {
71
17
            return Err(error::Error::BadOffset(offset).into())
72
11.1k
        }
73
11.1k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
11.1k
    }
<[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.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
5.70k
        let len = self.measure_with(&ctx);
70
5.70k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
5.70k
        }
73
5.70k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
5.70k
    }
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
19.8k
    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
19.8k
        let len = self.measure_with(&ctx);
70
19.8k
        if offset >= len {
71
18
            return Err(error::Error::BadOffset(offset).into())
72
19.8k
        }
73
19.8k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
19.8k
    }
<[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.8k
    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.8k
        let len = self.measure_with(&ctx);
70
13.8k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
13.8k
        }
73
13.8k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
13.8k
    }
<[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.30k
    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.30k
        let len = self.measure_with(&ctx);
70
1.30k
        if offset >= len {
71
9
            return Err(error::Error::BadOffset(offset).into())
72
1.29k
        }
73
1.29k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
1.30k
    }
<[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
513
    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
513
        let len = self.measure_with(&ctx);
70
513
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
513
        }
73
513
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
513
    }
<[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.57k
    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.57k
        let len = self.measure_with(&ctx);
70
2.57k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
2.57k
        }
73
2.57k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
2.57k
    }
<[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
436k
    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
436k
        let len = self.measure_with(&ctx);
70
436k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
436k
        }
73
436k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
436k
    }
<[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
4.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
4.90k
        let len = self.measure_with(&ctx);
70
4.90k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
4.90k
        }
73
4.90k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
4.90k
    }
<[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.74k
    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.74k
        let len = self.measure_with(&ctx);
70
8.74k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
8.74k
        }
73
8.74k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
8.74k
    }
<[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
16.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
16.5k
        let len = self.measure_with(&ctx);
70
16.5k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
16.5k
        }
73
16.5k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
16.5k
    }
<[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
22.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
22.9k
        let len = self.measure_with(&ctx);
70
22.9k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
22.9k
        }
73
22.9k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
22.9k
    }
<[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
3.86k
    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.86k
        let len = self.measure_with(&ctx);
70
3.86k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
3.86k
        }
73
3.86k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
3.86k
    }
<[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
1.76M
    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.76M
        let len = self.measure_with(&ctx);
70
1.76M
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
1.76M
        }
73
1.76M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
1.76M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_loader::pe::Section>
Line
Count
Source
68
15.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
15.0k
        let len = self.measure_with(&ctx);
70
15.0k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
15.0k
        }
73
15.0k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
15.0k
    }
<[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
4.33M
    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
4.33M
        let len = self.measure_with(&ctx);
70
4.33M
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
4.33M
        }
73
4.33M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
4.33M
    }
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
43.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
43.0M
        let len = self.measure_with(&ctx);
70
43.0M
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
43.0M
        }
73
43.0M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
43.0M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<td_loader::elf64::Rela>
Line
Count
Source
68
4.16M
    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
4.16M
        let len = self.measure_with(&ctx);
70
4.16M
        if offset >= len {
71
3
            return Err(error::Error::BadOffset(offset).into())
72
4.16M
        }
73
4.16M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
4.16M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<u32>
Line
Count
Source
68
12.8k
    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.8k
        let len = self.measure_with(&ctx);
70
12.8k
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
12.8k
        }
73
12.8k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
12.8k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<u16>
Line
Count
Source
68
1.96M
    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.96M
        let len = self.measure_with(&ctx);
70
1.96M
        if offset >= len {
71
0
            return Err(error::Error::BadOffset(offset).into())
72
1.96M
        }
73
1.96M
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
1.96M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::pread_with::<u64>
Line
Count
Source
68
30.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
30.4k
        let len = self.measure_with(&ctx);
70
30.4k
        if offset >= len {
71
196
            return Err(error::Error::BadOffset(offset).into())
72
30.2k
        }
73
30.2k
        N::try_from_ctx(&self[offset..], ctx).and_then(|(n, _)| Ok(n))
74
30.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
150M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
150M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
150M
        result::Result<N, E>
101
150M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
150M
    {
103
150M
        let o = *offset;
104
150M
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
150M
        //     *offset += size;
106
150M
        //     Ok(n)
107
150M
        // })
108
150M
        let len = self.measure_with(&ctx);
109
150M
        if o >= len {
110
2.49k
            return Err(error::Error::BadOffset(o).into())
111
150M
        }
112
150M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
150M
            *offset += size;
114
150M
            Ok(n)
115
150M
        })
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.7k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
16.7k
            *offset += size;
114
16.7k
            Ok(n)
115
16.7k
        })
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
486k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
486k
            *offset += size;
114
486k
            Ok(n)
115
486k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u32>::{closure#0}
Line
Count
Source
112
15.6k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
15.6k
            *offset += size;
114
15.6k
            Ok(n)
115
15.6k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u16>::{closure#0}
Line
Count
Source
112
4.93k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
4.93k
            *offset += size;
114
4.93k
            Ok(n)
115
4.93k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u64>::{closure#0}
Line
Count
Source
112
4.98k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
4.98k
            *offset += size;
114
4.98k
            Ok(n)
115
4.98k
        })
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.4k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
33.4k
            *offset += size;
114
33.4k
            Ok(n)
115
33.4k
        })
<[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
16.5k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
16.5k
            *offset += size;
114
16.5k
            Ok(n)
115
16.5k
        })
<[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
493k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
493k
            *offset += size;
114
493k
            Ok(n)
115
493k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u8>::{closure#0}
Line
Count
Source
112
8.61M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
8.61M
            *offset += size;
114
8.61M
            Ok(n)
115
8.61M
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u32>::{closure#0}
Line
Count
Source
112
2.36M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
2.36M
            *offset += size;
114
2.36M
            Ok(n)
115
2.36M
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u16>::{closure#0}
Line
Count
Source
112
4.52M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
4.52M
            *offset += size;
114
4.52M
            Ok(n)
115
4.52M
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u64>::{closure#0}
Line
Count
Source
112
135k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
135k
            *offset += size;
114
135k
            Ok(n)
115
135k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u8>::{closure#0}
Line
Count
Source
112
295k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
295k
            *offset += size;
114
295k
            Ok(n)
115
295k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u32>::{closure#0}
Line
Count
Source
112
8.79M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
8.79M
            *offset += size;
114
8.79M
            Ok(n)
115
8.79M
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u16>::{closure#0}
Line
Count
Source
112
116k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
116k
            *offset += size;
114
116k
            Ok(n)
115
116k
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<i64>::{closure#0}
Line
Count
Source
112
4.16M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
4.16M
            *offset += size;
114
4.16M
            Ok(n)
115
4.16M
        })
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u64>::{closure#0}
Line
Count
Source
112
120M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
120M
            *offset += size;
114
120M
            Ok(n)
115
120M
        })
116
150M
    }
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.7k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
16.7k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
16.7k
        result::Result<N, E>
101
16.7k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
16.7k
    {
103
16.7k
        let o = *offset;
104
16.7k
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
16.7k
        //     *offset += size;
106
16.7k
        //     Ok(n)
107
16.7k
        // })
108
16.7k
        let len = self.measure_with(&ctx);
109
16.7k
        if o >= len {
110
4
            return Err(error::Error::BadOffset(o).into())
111
16.7k
        }
112
16.7k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
16.7k
        })
116
16.7k
    }
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
486k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
486k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
486k
        result::Result<N, E>
101
486k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
486k
    {
103
486k
        let o = *offset;
104
486k
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
486k
        //     *offset += size;
106
486k
        //     Ok(n)
107
486k
        // })
108
486k
        let len = self.measure_with(&ctx);
109
486k
        if o >= len {
110
174
            return Err(error::Error::BadOffset(o).into())
111
486k
        }
112
486k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
486k
        })
116
486k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u32>
Line
Count
Source
98
15.6k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
15.6k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
15.6k
        result::Result<N, E>
101
15.6k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
15.6k
    {
103
15.6k
        let o = *offset;
104
15.6k
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
15.6k
        //     *offset += size;
106
15.6k
        //     Ok(n)
107
15.6k
        // })
108
15.6k
        let len = self.measure_with(&ctx);
109
15.6k
        if o >= len {
110
9
            return Err(error::Error::BadOffset(o).into())
111
15.6k
        }
112
15.6k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
15.6k
        })
116
15.6k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u16>
Line
Count
Source
98
4.94k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
4.94k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
4.94k
        result::Result<N, E>
101
4.94k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
4.94k
    {
103
4.94k
        let o = *offset;
104
4.94k
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
4.94k
        //     *offset += size;
106
4.94k
        //     Ok(n)
107
4.94k
        // })
108
4.94k
        let len = self.measure_with(&ctx);
109
4.94k
        if o >= len {
110
3
            return Err(error::Error::BadOffset(o).into())
111
4.93k
        }
112
4.93k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
4.93k
        })
116
4.94k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u64>
Line
Count
Source
98
5.00k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
5.00k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
5.00k
        result::Result<N, E>
101
5.00k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
5.00k
    {
103
5.00k
        let o = *offset;
104
5.00k
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
5.00k
        //     *offset += size;
106
5.00k
        //     Ok(n)
107
5.00k
        // })
108
5.00k
        let len = self.measure_with(&ctx);
109
5.00k
        if o >= len {
110
3
            return Err(error::Error::BadOffset(o).into())
111
5.00k
        }
112
5.00k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
5.00k
        })
116
5.00k
    }
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.4k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
33.4k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
33.4k
        result::Result<N, E>
101
33.4k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
33.4k
    {
103
33.4k
        let o = *offset;
104
33.4k
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
33.4k
        //     *offset += size;
106
33.4k
        //     Ok(n)
107
33.4k
        // })
108
33.4k
        let len = self.measure_with(&ctx);
109
33.4k
        if o >= len {
110
15
            return Err(error::Error::BadOffset(o).into())
111
33.4k
        }
112
33.4k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
33.4k
        })
116
33.4k
    }
<[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
16.5k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
16.5k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
16.5k
        result::Result<N, E>
101
16.5k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
16.5k
    {
103
16.5k
        let o = *offset;
104
16.5k
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
16.5k
        //     *offset += size;
106
16.5k
        //     Ok(n)
107
16.5k
        // })
108
16.5k
        let len = self.measure_with(&ctx);
109
16.5k
        if o >= len {
110
0
            return Err(error::Error::BadOffset(o).into())
111
16.5k
        }
112
16.5k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
16.5k
        })
116
16.5k
    }
<[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
493k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
493k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
493k
        result::Result<N, E>
101
493k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
493k
    {
103
493k
        let o = *offset;
104
493k
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
493k
        //     *offset += size;
106
493k
        //     Ok(n)
107
493k
        // })
108
493k
        let len = self.measure_with(&ctx);
109
493k
        if o >= len {
110
0
            return Err(error::Error::BadOffset(o).into())
111
493k
        }
112
493k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
493k
        })
116
493k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u8>
Line
Count
Source
98
8.61M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
8.61M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
8.61M
        result::Result<N, E>
101
8.61M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
8.61M
    {
103
8.61M
        let o = *offset;
104
8.61M
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
8.61M
        //     *offset += size;
106
8.61M
        //     Ok(n)
107
8.61M
        // })
108
8.61M
        let len = self.measure_with(&ctx);
109
8.61M
        if o >= len {
110
498
            return Err(error::Error::BadOffset(o).into())
111
8.61M
        }
112
8.61M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
8.61M
        })
116
8.61M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u32>
Line
Count
Source
98
2.36M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
2.36M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
2.36M
        result::Result<N, E>
101
2.36M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
2.36M
    {
103
2.36M
        let o = *offset;
104
2.36M
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
2.36M
        //     *offset += size;
106
2.36M
        //     Ok(n)
107
2.36M
        // })
108
2.36M
        let len = self.measure_with(&ctx);
109
2.36M
        if o >= len {
110
18
            return Err(error::Error::BadOffset(o).into())
111
2.36M
        }
112
2.36M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
2.36M
        })
116
2.36M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u16>
Line
Count
Source
98
4.52M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
4.52M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
4.52M
        result::Result<N, E>
101
4.52M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
4.52M
    {
103
4.52M
        let o = *offset;
104
4.52M
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
4.52M
        //     *offset += size;
106
4.52M
        //     Ok(n)
107
4.52M
        // })
108
4.52M
        let len = self.measure_with(&ctx);
109
4.52M
        if o >= len {
110
6
            return Err(error::Error::BadOffset(o).into())
111
4.52M
        }
112
4.52M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
4.52M
        })
116
4.52M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u64>
Line
Count
Source
98
135k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
135k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
135k
        result::Result<N, E>
101
135k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
135k
    {
103
135k
        let o = *offset;
104
135k
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
135k
        //     *offset += size;
106
135k
        //     Ok(n)
107
135k
        // })
108
135k
        let len = self.measure_with(&ctx);
109
135k
        if o >= len {
110
2
            return Err(error::Error::BadOffset(o).into())
111
135k
        }
112
135k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
135k
        })
116
135k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u8>
Line
Count
Source
98
295k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
295k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
295k
        result::Result<N, E>
101
295k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
295k
    {
103
295k
        let o = *offset;
104
295k
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
295k
        //     *offset += size;
106
295k
        //     Ok(n)
107
295k
        // })
108
295k
        let len = self.measure_with(&ctx);
109
295k
        if o >= len {
110
40
            return Err(error::Error::BadOffset(o).into())
111
295k
        }
112
295k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
295k
        })
116
295k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u32>
Line
Count
Source
98
8.80M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
8.80M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
8.80M
        result::Result<N, E>
101
8.80M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
8.80M
    {
103
8.80M
        let o = *offset;
104
8.80M
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
8.80M
        //     *offset += size;
106
8.80M
        //     Ok(n)
107
8.80M
        // })
108
8.80M
        let len = self.measure_with(&ctx);
109
8.80M
        if o >= len {
110
93
            return Err(error::Error::BadOffset(o).into())
111
8.80M
        }
112
8.80M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
8.80M
        })
116
8.80M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u16>
Line
Count
Source
98
117k
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
117k
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
117k
        result::Result<N, E>
101
117k
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
117k
    {
103
117k
        let o = *offset;
104
117k
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
117k
        //     *offset += size;
106
117k
        //     Ok(n)
107
117k
        // })
108
117k
        let len = self.measure_with(&ctx);
109
117k
        if o >= len {
110
20
            return Err(error::Error::BadOffset(o).into())
111
116k
        }
112
116k
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
116k
        })
116
117k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<i64>
Line
Count
Source
98
4.16M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
4.16M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
4.16M
        result::Result<N, E>
101
4.16M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
4.16M
    {
103
4.16M
        let o = *offset;
104
4.16M
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
4.16M
        //     *offset += size;
106
4.16M
        //     Ok(n)
107
4.16M
        // })
108
4.16M
        let len = self.measure_with(&ctx);
109
4.16M
        if o >= len {
110
43
            return Err(error::Error::BadOffset(o).into())
111
4.16M
        }
112
4.16M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
4.16M
        })
116
4.16M
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_with::<u64>
Line
Count
Source
98
120M
    fn gread_with<'a, N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>>
99
120M
        (&'a self, offset: &mut usize, ctx: Ctx) ->
100
120M
        result::Result<N, E>
101
120M
        where <Self as Index<RangeFrom<usize>>>::Output: 'a
102
120M
    {
103
120M
        let o = *offset;
104
120M
        // self.pread_with(o, ctx).and_then(|(n, size)| {
105
120M
        //     *offset += size;
106
120M
        //     Ok(n)
107
120M
        // })
108
120M
        let len = self.measure_with(&ctx);
109
120M
        if o >= len {
110
1.56k
            return Err(error::Error::BadOffset(o).into())
111
120M
        }
112
120M
        N::try_from_ctx(&self[o..], ctx).and_then(|(n, size)| {
113
            *offset += size;
114
            Ok(n)
115
120M
        })
116
120M
    }
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
0
    {
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
635k
    fn gread_inout_with<'a, N>(&'a self, offset: &mut usize, inout: &mut [N], ctx: Ctx) -> result::Result<(), E>
153
635k
        where
154
635k
        N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>,
155
635k
    <Self as Index<RangeFrom<usize>>>::Output: 'a
156
635k
    {
157
9.12M
        for i in inout.iter_mut() {
158
9.12M
            *i = self.gread_with(offset, ctx)?;
159
        }
160
634k
        Ok(())
161
635k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_inout_with::<u8>
Line
Count
Source
152
38.6k
    fn gread_inout_with<'a, N>(&'a self, offset: &mut usize, inout: &mut [N], ctx: Ctx) -> result::Result<(), E>
153
38.6k
        where
154
38.6k
        N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>,
155
38.6k
    <Self as Index<RangeFrom<usize>>>::Output: 'a
156
38.6k
    {
157
399k
        for i in inout.iter_mut() {
158
399k
            *i = self.gread_with(offset, ctx)?;
159
        }
160
38.4k
        Ok(())
161
38.6k
    }
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
570k
    fn gread_inout_with<'a, N>(&'a self, offset: &mut usize, inout: &mut [N], ctx: Ctx) -> result::Result<(), E>
153
570k
        where
154
570k
        N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>,
155
570k
    <Self as Index<RangeFrom<usize>>>::Output: 'a
156
570k
    {
157
8.43M
        for i in inout.iter_mut() {
158
8.43M
            *i = self.gread_with(offset, ctx)?;
159
        }
160
570k
        Ok(())
161
570k
    }
<[u8] as scroll::pread::Pread<scroll::endian::Endian, scroll::error::Error>>::gread_inout_with::<u8>
Line
Count
Source
152
25.9k
    fn gread_inout_with<'a, N>(&'a self, offset: &mut usize, inout: &mut [N], ctx: Ctx) -> result::Result<(), E>
153
25.9k
        where
154
25.9k
        N: TryFromCtx<'a, Ctx, <Self as Index<RangeFrom<usize>>>::Output, Error = E>,
155
25.9k
    <Self as Index<RangeFrom<usize>>>::Output: 'a
156
25.9k
    {
157
295k
        for i in inout.iter_mut() {
158
295k
            *i = self.gread_with(offset, ctx)?;
159
        }
160
25.9k
        Ok(())
161
25.9k
    }
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 {}