Skip to main content

RenderedUnit

Struct RenderedUnit 

Source
pub struct RenderedUnit<R: Role> { /* private fields */ }
Expand description

One unit a renderer actually materialized.

Its seat and every fact that seat’s planned member states are carried, so a proof can rebuild a membership out of a rendering and compare it against the declared one; the tree, the identity, and the digest are the rendering’s own.

§Nonclaims

The Rust source text is not a member of the unit. It is GeneratedTree::inspected — a projection of the tree, for a person.

Implementations§

Source§

impl<R: Role> RenderedUnit<R>

Source

pub fn materialized( planned: &PlannedMember<R>, tree: GeneratedTree, ) -> Result<Self, RenderError>

Materialize one planned member out of the tree a renderer produced.

A rendered unit IS a planned member plus the bytes that answer it, so every fact the member already states is read off it rather than restated at the call — nothing here can pair one seat’s key with another seat’s origin. The digest and this unit’s own identity are both taken here, over the tree’s canonical bytes, under that key at that seat’s roster position.

§Errors

Returns RenderError::BytesUnbounded where the rendered bytes pass RENDERED_BYTE_LIMIT.

Source

pub const fn role(&self) -> R

The seat this unit was rendered under.

Source

pub const fn identity(&self) -> Identity<RenderedUnit>

This rendered unit’s own identity.

Source

pub const fn semantic_key(&self) -> Identity<GeneratedUnit>

The semantic key this unit answers to.

Source

pub fn destination(&self) -> Destination

Which delivery this unit lands in.

Read off the seat and never stored: a delivery a unit could disagree with its own role about would be a second answer to a question the roster already answers.

Source

pub const fn profile(&self) -> Profile

The profile this unit was rendered under.

Source

pub const fn origin(&self) -> &OriginTrail

Where this unit came from.

Source

pub const fn address(&self) -> Option<OwnerIdentity>

The address a publication writes this unit to, where its seat is one that writes to an address.

Source

pub const fn tree(&self) -> &GeneratedTree

The token tree this unit is.

Source

pub const fn digest(&self) -> Identity<OutputBytes>

The digest over this unit’s canonical bytes.

Source

pub fn bytes(&self) -> Vec<u8>

This unit’s canonical bytes — the exact material the digest was taken over.

Derived from the tree on every reading rather than kept beside it, so there is no second copy of one unit’s bytes to disagree with the tree.

Source

pub fn reconstructed(&self) -> PlannedMember<R>

The membership row this unit reconstructs — the renderer’s own answer to what it materialized, in exactly the shape a plan states it.

Source

pub fn digest_under(&self, contract: DigestContract) -> Identity<OutputBytes>

The digest recomputed from the bytes this unit carries, under one stated contract.

A proof compares this against RenderedUnit::digest: a digest that does not survive being recomputed under the plan’s own contract is a digest of something else.

Trait Implementations§

Source§

impl<R: Clone + Role> Clone for RenderedUnit<R>

Source§

fn clone(&self) -> RenderedUnit<R>

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<R: Debug + Role> Debug for RenderedUnit<R>

Source§

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

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

impl<R: Eq + Role> Eq for RenderedUnit<R>

Source§

impl<R: PartialEq + Role> PartialEq for RenderedUnit<R>

Source§

fn eq(&self, other: &RenderedUnit<R>) -> bool

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

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

Inequality operator !=. Read more
Source§

impl<R: PartialEq + Role> StructuralPartialEq for RenderedUnit<R>

Auto Trait Implementations§

§

impl<R> Freeze for RenderedUnit<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for RenderedUnit<R>
where R: RefUnwindSafe,

§

impl<R> Send for RenderedUnit<R>
where R: Send,

§

impl<R> Sync for RenderedUnit<R>
where R: Sync,

§

impl<R> Unpin for RenderedUnit<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for RenderedUnit<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for RenderedUnit<R>
where R: UnwindSafe,

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> 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.