pub struct Layout {
pub items: Vec<Item>,
/* private fields */
}Expand description
A type’s layout: its items, its layout form and its tag (core §7.6).
Fields§
§items: Vec<Item>Implementations§
Source§impl Layout
impl Layout
Sourcepub fn sha256_hex(&self) -> String
pub fn sha256_hex(&self) -> String
The sha256 of the layout form’s JCS bytes, in lowercase hex.
Sourcepub fn min_bits(&self) -> u64
pub fn min_bits(&self) -> u64
The shortest record this revision writes, before the pad: every optional field absent and the first marker 0.
Sourcepub fn max_bits(&self) -> u64
pub fn max_bits(&self) -> u64
The longest: every field present, every marker before one 1, and the last marker 0.
Sourcepub fn fields(&self) -> impl Iterator<Item = &Field>
pub fn fields(&self) -> impl Iterator<Item = &Field>
Its fields, the extension markers left out.
Sourcepub fn write(
&self,
value: &Value,
epoch: Option<i64>,
) -> Result<Record, WriteRefusal>
pub fn write( &self, value: &Value, epoch: Option<i64>, ) -> Result<Record, WriteRefusal>
Writes a value, the JSON object core §7.6’s reading spells, under
the deployment epoch in seconds its time fields are written since
(None: the deployment states none, DEFAULT_EPOCH).
§Errors
The writer’s refusal: WriteRefusal.
Sourcepub fn read(
&self,
tag: u8,
bytes: &[u8],
epoch: Option<i64>,
) -> Result<Value, ReadRefusal>
pub fn read( &self, tag: u8, bytes: &[u8], epoch: Option<i64>, ) -> Result<Value, ReadRefusal>
Reads a record under the tag its envelope’s CH carries, refusing it
for the first of core §7.6’s checks that applies, its time fields
under the deployment epoch (None: DEFAULT_EPOCH).
§Errors
The reader’s refusal: ReadRefusal.
Sourcepub fn check(&self, tag: u8, bytes: &[u8]) -> Result<(), ReadRefusal>
pub fn check(&self, tag: u8, bytes: &[u8]) -> Result<(), ReadRefusal>
Layout::read’s checks, with no value made and no epoch needed: a
writer’s or a reader’s admission of a record (#979 B2’s runtime).
§Errors
The reader’s refusal, never ReadRefusal::Epoch.
Trait Implementations§
impl Eq for Layout
impl StructuralPartialEq for Layout
Auto Trait Implementations§
impl Forget for Layout
impl Freeze for Layoutwhere
*const u8 is !null: Freeze,
PhantomData<Item>: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Value>: Freeze,
*const LeafNode<String, Value> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: 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 u8 is !null: UnsafeUnpin,
PhantomData<Item>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
impl UnwindSafe for Layout
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