Skip to main content

Layout

Struct Layout 

Source
pub struct Layout {
    pub params: FrameParams,
    /* private fields */
}
Expand description

A frame resource’s layout (core §7.7): its record type’s fields, its table, and the frame form its tag comes from.

Fields§

§params: FrameParams

Implementations§

Source§

impl Layout

Source

pub fn of(record: &Layout, params: &FrameParams) -> Result<Self, String>

The layout of a frame of record’s type under params.

§Errors

Why there is none: the record type has an extension marker (E047), or a deadband names no field of it, or one that is not an int, fixed or counter (E049).

Source

pub fn of_resource(c: &Contract, r: &Resource) -> Result<Option<Self>, String>

The layout of a contract’s frame resource: None for a resource that is no frame resource.

§Errors

Why a frame resource has none: its type’s layout (an artifact missing, or a declaration with a finding), or Layout::of’s.

Source

pub fn form(&self) -> &Value

The frame form: the root of the tag (core §7.7).

Source

pub fn sha256_hex(&self) -> String

The sha256 of the frame form’s JCS bytes, in lowercase hex.

Source

pub fn tag(&self) -> Tag

The tag CH carries: the low four bits of the hash’s last byte.

Source

pub fn count_bits(&self) -> u32

The count’s width, ⌈log₂ records⌉: none for a one-record frame.

Source

pub fn offset_bits(&self) -> Option<u32>

The offset’s width, ⌈log₂ span⌉, where the frame has a step.

Source

pub fn span_ms(&self) -> Option<u64>

The span, where the frame has a step.

Source

pub fn fields(&self) -> &[Field]

The record type’s fields, in order.

Source

pub fn deadband(&self, index: usize) -> Option<&Deadband>

The deadband of the field at index, if it has one.

Source§

impl Layout

Source

pub fn slots_of(&self, record: &[u8]) -> Result<Vec<Slot>, ReadRefusal>

A §7.6 record of the frame’s record type read into a full record’s slots: each field absent or its code. The record’s own tag is not asked: its bytes are the type’s.

§Errors

ReadRefusal::Length, ReadRefusal::Code or ReadRefusal::Pad, as §7.6’s reader refuses the record.

Source

pub fn slots_of_json( &self, v: &Value, epoch: Option<i64>, ) -> Result<Vec<Slot>, WriteRefusal>

A record in §7.6’s JSON reading, a field’s name to its value, read into a full record’s slots: an optional field left out or null is absent. A time field counts from epoch.

§Errors

WriteRefusal: value for a value that is no object, unknown for a name the type does not have, missing for a field that is not optional left out, and §7.6’s refusals of a value.

Source

pub fn largest_body_bits(&self) -> u64

The bits of the largest frame an owner writes (link.v1 §2.8’s frame_over_batch, 0.16, F-470): records records, every optional field present, and every record after record 0 measured, with its offset. As many of them as keyframe_every allows are delta records that include every field, each a bit per field longer than a full record (core §7.7): a full record comes at least once every keyframe_every, so records − ⌊records / keyframe_every⌋ of them, none at 1. The rest are full.

Source

pub fn largest_payload_bytes(&self) -> u64

The payload of that largest frame, in bytes: its body after an envelope of a 32-bit run, 8 bytes (core §7.5).

Trait Implementations§

Source§

impl Clone for Layout

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 Layout

Source§

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

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

impl Eq for Layout

Source§

impl PartialEq for Layout

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 Layout

Auto Trait Implementations§

§

impl Forget for Layout

§

impl Freeze for Layout

§

impl Move for Layout

§

impl RefUnwindSafe for Layout

§

impl Send for Layout
where NodeRef<Owned, String, Deadband, LeafOrInternal>: Send, BoxRaw<(String, Deadband)>: Send, RawVecInner: Send, &'static str: Send, NodeRef<Owned, String, Value, LeafOrInternal>: Send, BoxRaw<(String, Value)>: Send,

§

impl Sync for Layout
where NodeRef<Owned, String, Deadband, LeafOrInternal>: Sync, BoxRaw<(String, Deadband)>: Sync, RawVecInner: Sync, NodeRef<Owned, String, Value, LeafOrInternal>: Sync, BoxRaw<(String, Value)>: Sync,

§

impl Unpin for Layout
where *const LeafNode<String, Deadband> is !null: Unpin, Box<(String, Deadband)>: Unpin, *const u8 is !null: Unpin, &'static str: Unpin, *const LeafNode<String, Value> is !null: Unpin, Box<(String, Value)>: Unpin,

§

impl UnsafeUnpin for Layout

§

impl UnwindSafe for Layout

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> AsNode<T> for T

Source§

fn as_node(&self) -> &T

Source§

impl<T> AsNodeMut<T> for T

Source§

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

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.