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: FrameParamsImplementations§
Source§impl Layout
impl Layout
Sourcepub fn of(record: &Layout, params: &FrameParams) -> Result<Self, String>
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).
Sourcepub fn of_resource(c: &Contract, r: &Resource) -> Result<Option<Self>, String>
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.
Sourcepub fn sha256_hex(&self) -> String
pub fn sha256_hex(&self) -> String
The sha256 of the frame form’s JCS bytes, in lowercase hex.
Sourcepub fn count_bits(&self) -> u32
pub fn count_bits(&self) -> u32
The count’s width, ⌈log₂ records⌉: none for a one-record frame.
Sourcepub fn offset_bits(&self) -> Option<u32>
pub fn offset_bits(&self) -> Option<u32>
The offset’s width, ⌈log₂ span⌉, where the frame has a step.
Source§impl Layout
impl Layout
Sourcepub fn slots_of(&self, record: &[u8]) -> Result<Vec<Slot>, ReadRefusal>
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.
Sourcepub fn slots_of_json(
&self,
v: &Value,
epoch: Option<i64>,
) -> Result<Vec<Slot>, WriteRefusal>
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.
Sourcepub fn largest_body_bits(&self) -> u64
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.
Sourcepub fn largest_payload_bytes(&self) -> u64
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§
impl Eq for Layout
impl StructuralPartialEq for Layout
Auto Trait Implementations§
impl Forget for Layout
impl Freeze for Layoutwhere
*const LeafNode<String, Deadband> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Deadband)>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<Field>: Freeze,
PhantomData<Option<Deadband>>: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Value>: Freeze,
*const LeafNode<String, Value> is !null: Freeze,
PhantomData<Box<(String, Value)>>: Freeze,
impl Move for Layout
impl RefUnwindSafe for Layout
impl Send for Layout
impl Sync for Layout
impl Unpin for Layout
impl UnsafeUnpin for Layoutwhere
*const LeafNode<String, Deadband> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Deadband)>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<Field>: UnsafeUnpin,
PhantomData<Option<Deadband>>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
impl UnwindSafe for Layoutwhere
BTreeMap<String, Deadband>: UnwindSafe,
RawVecInner: UnwindSafe,
&'static str: UnwindSafe,
BTreeMap<String, Value>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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