pub struct Validated<'a> { /* private fields */ }Expand description
A validated image plus zero-copy accessors.
Implementations§
Source§impl<'a> Validated<'a>
impl<'a> Validated<'a>
Sourcepub fn new(buf: &'a [u8], opts: DecodeOpts) -> Result<Self>
pub fn new(buf: &'a [u8], opts: DecodeOpts) -> Result<Self>
Parse and validate buf.
pub fn buf(&self) -> &'a [u8] ⓘ
Sourcepub fn limits_snapshot(&self) -> Limits
pub fn limits_snapshot(&self) -> Limits
The limits this image was validated against.
pub fn header(&self) -> &Header
pub fn limits_span(&self, section: Section) -> (u32, u32)
pub fn span(&self, section: Section) -> SectionSpan
Sourcepub fn section_len(&self, section: Section) -> u64
pub fn section_len(&self, section: Section) -> u64
Byte length of a section body (from its offset to its computed end).
pub fn section(&self, section: Section) -> &'a [u8] ⓘ
pub fn node_count(&self) -> u32
Sourcepub fn field(&self, index: u32) -> Result<(u32, NodeId)>
pub fn field(&self, index: u32) -> Result<(u32, NodeId)>
Read a field entry (string id, node id).
Sourcepub fn string_heap_len(&self) -> u32
pub fn string_heap_len(&self) -> u32
Byte length of the string heap (excluding the offset table).
Sourcepub fn string(&self, id: u32) -> Result<&'a str>
pub fn string(&self, id: u32) -> Result<&'a str>
Borrow string id directly from the buffer (zero copy).
Sourcepub fn blob_heap_len(&self) -> u32
pub fn blob_heap_len(&self) -> u32
Total blob payload heap length.
Sourcepub fn blob_entry(&self, id: u32) -> Result<([u8; 32], u32, u32)>
pub fn blob_entry(&self, id: u32) -> Result<([u8; 32], u32, u32)>
Read a blob index entry: (hash, offset-in-heap, length).
Sourcepub fn blob(&self, id: u32) -> Result<&'a [u8]>
pub fn blob(&self, id: u32) -> Result<&'a [u8]>
Borrow a blob payload directly from the buffer (zero copy).
Sourcepub fn annotation(&self, index: u32) -> Result<(u32, u32, u32, u32)>
pub fn annotation(&self, index: u32) -> Result<(u32, u32, u32, u32)>
Read an annotation record: (node, kind, a, b).
Sourcepub fn type_entry(&self, id: u32) -> Result<(u32, u32, u32, u32)>
pub fn type_entry(&self, id: u32) -> Result<(u32, u32, u32, u32)>
Read a type table entry: (code, flags, aux start, aux count).
Sourcepub fn extension_entry(&self, index: u32) -> Result<(u64, u32, u32)>
pub fn extension_entry(&self, index: u32) -> Result<(u64, u32, u32)>
Read one extension directory entry: (tag, payload offset, payload len).
Sourcepub fn extension_payload(&self, offset: u32, len: u32) -> Result<&'a [u8]>
pub fn extension_payload(&self, offset: u32, len: u32) -> Result<&'a [u8]>
Borrow an extension payload (zero copy).
Sourcepub fn provenance(&self) -> Result<Option<Provenance>>
pub fn provenance(&self) -> Result<Option<Provenance>>
Parse the provenance block.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Validated<'a>
impl<'a> RefUnwindSafe for Validated<'a>
impl<'a> Send for Validated<'a>
impl<'a> Sync for Validated<'a>
impl<'a> Unpin for Validated<'a>
impl<'a> UnsafeUnpin for Validated<'a>
impl<'a> UnwindSafe for Validated<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more