Skip to main content

View

Struct View 

Source
pub struct View<K: Kind> { /* private fields */ }
Expand description

One complete explanation: every question a kind owes, answered exactly once, over the plan and the proof the answers are ABOUT.

Holding one is the coverage proof, and there is no partial view — a set of answers that could not be completed is a refusal instead.

§Authority

The parentage is taken and never supplied. A view assembled from two identities beside the answers would name a plan and a closure it was never written over: every question answered correctly, about a different expansion of the same kind, and the type parameter cannot catch that because a kind is not an expansion.

§Ordering

The universal seats stand in the compiler’s roster order and the declared seats in the kind’s, never in the order a caller supplied them. That order is what the identity is derived over, so one set of answers is one explanation however it was assembled.

Implementations§

Source§

impl<K: Kind> View<K>

Source

pub fn complete( plan: &Plan<K>, closure: &Closure<K::Role>, universal: Vec<UniversalAnswer>, declared: Vec<<K::Question as Question>::Answer>, ) -> Result<Self, ExplanationError>

Complete one view over the universal questions and the kind’s own, answered over one plan and the proof of its rendering.

§The parentage is taken, never supplied

The plan arrives as the PLAN and the closure as the PROOF, and both identities are read off them here. A road that took two identities beside the answers would take two values any caller can spell, and the view it built would name a parentage it was never written over — which is a complete, well-formed explanation about something else. A Closure is reachable only by proving a rendering against a plan, so a caller standing here has done that or has nothing to hand in, and its role roster is the kind’s own.

§The explanation transcript

This is a mint site, so its content grammar is stated in full. The identity is derived under Role::Explanation, anchored on the CLOSURE’s identity at full width — an explanation is written after a closure and over it — at position zero, over

content = bytes(plan) || u64be(universal seats) || seat* || u64be(declared seats) || seat*

where each seat is the question’s roster position in two big-endian bytes followed by the answer’s own canonical bytes, in that roster’s declared order. The two rosters are written behind two counts, so the split between them is framed rather than inferred: a universal seat and a declared seat may share a position. Human prose is not a member — a rendered line is a projection of a typed answer, so a preimage carrying one would commit to a rendering rather than to what was answered.

§Errors

Returns ExplanationError naming every unanswered question, every doubled question, every answer standing outside its own roster, the seat bound where a kind’s roster outgrows it, and an output answer that does not restate the proof’s own rendered roster. All of them together: a caller repairing a view one question per attempt is a caller the protocol failed.

Source

pub const fn identity(&self) -> ExplanationId

This view’s own identity — the name a binding commits to.

Source

pub const fn provenance(&self) -> &Provenance

The record of how that identity was derived.

Source

pub const fn plan(&self) -> PlanId

The plan this view was answered over.

Read back so a binding establishes that the plan it seals is the plan the answers are about, rather than assuming it.

Source

pub const fn closure(&self) -> ClosureId

The proved closure this view was answered over, on the same terms.

Source

pub fn universal(&self) -> &[UniversalAnswer]

The universal answers, in the compiler’s roster order.

Source

pub fn declared(&self) -> &[<K::Question as Question>::Answer]

The kind’s own answers, in the kind’s declared roster order.

Source

pub fn seats(&self) -> usize

How many seats this view fills, across both rosters.

Trait Implementations§

Source§

impl<K: Clone + Kind> Clone for View<K>
where K::Question: Clone,

Source§

fn clone(&self) -> View<K>

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<K: Debug + Kind> Debug for View<K>
where K::Question: Debug,

Source§

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

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

impl<K: Eq + Kind> Eq for View<K>
where K::Question: Eq,

Source§

impl<K: PartialEq + Kind> PartialEq for View<K>
where K::Question: PartialEq,

Source§

fn eq(&self, other: &View<K>) -> bool

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

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

Inequality operator !=. Read more
Source§

impl<K: PartialEq + Kind> StructuralPartialEq for View<K>
where K::Question: PartialEq,

Auto Trait Implementations§

§

impl<K> Freeze for View<K>
where Bounded<<<K as Kind>::Question as Question>::Answer, DECLARED_QUESTION_LIMIT>: Freeze, PhantomData<K>: Freeze,

§

impl<K> RefUnwindSafe for View<K>
where Bounded<<<K as Kind>::Question as Question>::Answer, DECLARED_QUESTION_LIMIT>: RefUnwindSafe, PhantomData<K>: RefUnwindSafe,

§

impl<K> Send for View<K>
where Bounded<<<K as Kind>::Question as Question>::Answer, DECLARED_QUESTION_LIMIT>: Send, PhantomData<K>: Send,

§

impl<K> Sync for View<K>
where Bounded<<<K as Kind>::Question as Question>::Answer, DECLARED_QUESTION_LIMIT>: Sync, PhantomData<K>: Sync,

§

impl<K> Unpin for View<K>
where Bounded<<<K as Kind>::Question as Question>::Answer, DECLARED_QUESTION_LIMIT>: Unpin, PhantomData<K>: Unpin,

§

impl<K> UnsafeUnpin for View<K>
where Bounded<<<K as Kind>::Question as Question>::Answer, DECLARED_QUESTION_LIMIT>: UnsafeUnpin, PhantomData<K>: UnsafeUnpin,

§

impl<K> UnwindSafe for View<K>
where Bounded<<<K as Kind>::Question as Question>::Answer, DECLARED_QUESTION_LIMIT>: UnwindSafe, PhantomData<K>: 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.