Skip to main content

CheckpointTable

Struct CheckpointTable 

Source
pub struct CheckpointTable {
    pub kind: u8,
    pub source_len: u64,
    pub graph_crc32c: u32,
    pub entries: Vec<CheckpointEntry>,
}
Expand description

A decoded CHECKPOINT record payload.

Fields§

§kind: u8

Checkpoint kind (only CHECKPOINT_KIND_OP_BOUNDARIES is valid here).

§source_len: u64

Declared total output length (must equal the source length).

§graph_crc32c: u32

CRC-32C of the GRAPH payload this checkpoint describes.

§entries: Vec<CheckpointEntry>

Per-op boundaries, in program order.

Implementations§

Source§

impl CheckpointTable

Source

pub fn from_program( program: &Program, object_lens: &[u64], channel_lens: &[u64], source_len: u64, limits: Limits, ) -> Result<CheckpointTable>

Build an OP_BOUNDARIES checkpoint from the authoritative program.

Per-op lengths come from Program::analyze_ops; the boundaries are their running sum. graph_crc32c is the CRC-32C of program.encode() — the exact GRAPH payload the checkpoint is bound to. No allocation is sized by an untrusted count: the vector is bounded by Limits::max_graph_ops.

Source

pub fn lengths(&self) -> Vec<u64>

The per-op output lengths, in program order.

Source

pub fn encode(&self) -> Result<Vec<u8>>

Encode the payload to canonical bytes.

Source

pub fn decode(bytes: &[u8], limits: Limits) -> Result<CheckpointTable>

Decode and structurally bound a payload.

This checks the size bound, the version, the kind, the reserved field, and that the declared entry count fits the payload. It does not check agreement with a program; call CheckpointTable::validate for that.

Source

pub fn validate( &self, program: &Program, graph_payload: &[u8], source_len: u64, object_lens: &[u64], channel_lens: &[u64], limits: Limits, ) -> Result<()>

Validate the checkpoint against the authoritative program and graph.

Requires: the declared kind is OP_BOUNDARIES; graph_payload’s CRC-32C equals the checkpoint’s binding; the declared source_len matches; the entry count matches the program; the entries are contiguous and cover the source exactly; and every entry’s out_len equals the program’s own Program::analyze_ops view. Any disagreement is a typed rejection — the checkpoint is never trusted.

Trait Implementations§

Source§

impl Clone for CheckpointTable

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 Debug for CheckpointTable

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for CheckpointTable

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for CheckpointTable

Source§

impl PartialEq for CheckpointTable

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CheckpointTable

Auto Trait Implementations§

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.