Skip to main content

Validated

Struct Validated 

Source
pub struct Validated<'a> { /* private fields */ }
Expand description

A validated image plus zero-copy accessors.

Implementations§

Source§

impl<'a> Validated<'a>

Source

pub fn new(buf: &'a [u8], opts: DecodeOpts) -> Result<Self>

Parse and validate buf.

Source

pub fn buf(&self) -> &'a [u8] ⓘ

Source

pub fn limits_snapshot(&self) -> Limits

The limits this image was validated against.

Source

pub fn header(&self) -> &Header

Source

pub fn limits_span(&self, section: Section) -> (u32, u32)

Source

pub fn span(&self, section: Section) -> SectionSpan

Source

pub fn section_len(&self, section: Section) -> u64

Byte length of a section body (from its offset to its computed end).

Source

pub fn section(&self, section: Section) -> &'a [u8] ⓘ

Source

pub fn meta(&self) -> Meta

Meta describing this image.

Source

pub fn node_count(&self) -> u32

Source

pub fn child(&self, index: u32) -> Result<u32>

Read a child index entry.

Source

pub fn field(&self, index: u32) -> Result<(u32, NodeId)>

Read a field entry (string id, node id).

Source

pub fn part(&self, index: u32) -> Result<(u32, u32)>

Read an interpolation part (tag, value).

Source

pub fn edge(&self, index: u32) -> Result<(u32, u32)>

Read an edge (from, to).

Source

pub fn string_heap_len(&self) -> u32

Byte length of the string heap (excluding the offset table).

Source

pub fn string(&self, id: u32) -> Result<&'a str>

Borrow string id directly from the buffer (zero copy).

Source

pub fn blob_heap_len(&self) -> u32

Total blob payload heap length.

Source

pub fn blob_entry(&self, id: u32) -> Result<([u8; 32], u32, u32)>

Read a blob index entry: (hash, offset-in-heap, length).

Source

pub fn blob(&self, id: u32) -> Result<&'a [u8]>

Borrow a blob payload directly from the buffer (zero copy).

Source

pub fn annotation(&self, index: u32) -> Result<(u32, u32, u32, u32)>

Read an annotation record: (node, kind, a, b).

Source

pub fn unit(&self, id: u32) -> Result<UnitTag>

Resolve a unit table entry.

Source

pub fn type_entry(&self, id: u32) -> Result<(u32, u32, u32, u32)>

Read a type table entry: (code, flags, aux start, aux count).

Source

pub fn aux(&self, index: u32) -> Result<(u32, u32)>

Read an aux record.

Source

pub fn number(&self, index: u32) -> Result<i64>

Read a number table entry.

Source

pub fn hash_entry(&self, index: u32) -> Result<[u8; 32]>

Read a hash table entry.

Source

pub fn extension_entry(&self, index: u32) -> Result<(u64, u32, u32)>

Read one extension directory entry: (tag, payload offset, payload len).

Source

pub fn extension_payload(&self, offset: u32, len: u32) -> Result<&'a [u8]>

Borrow an extension payload (zero copy).

Source

pub fn provenance(&self) -> Result<Option<Provenance>>

Parse the provenance block.

Source

pub fn root(&self) -> Result<Option<NodeId>>

Module root recorded in the bindings index (row 0), if any.

Source

pub fn bindings(&self) -> Result<Vec<(&'a str, NodeId)>>

Name bindings in canonical order (sorted by name).

Trait Implementations§

Source§

impl<'a> Clone for Validated<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for Validated<'a>

Source§

impl<'a> Debug for Validated<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.