pub struct Frame {
pub time: Option<Time>,
pub records: Vec<Record>,
}Expand description
A frame’s body, read: record 0’s time, None when the owner’s clock
was unknown, and its records.
Fields§
§time: Option<Time>§records: Vec<Record>Implementations§
Source§impl Frame
impl Frame
Sourcepub fn parse(
tag: Tag,
body: &[u8],
layout: &Layout,
) -> Result<Frame, ReadRefusal>
pub fn parse( tag: Tag, body: &[u8], layout: &Layout, ) -> Result<Frame, ReadRefusal>
A body read under the tag its envelope’s CH carries, refusing it for the first of core §7.7’s checks that applies.
§Errors
The reader’s refusal: ReadRefusal.
Sourcepub fn write(&self, layout: &Layout) -> Result<Record, WriteRefusal>
pub fn write(&self, layout: &Layout) -> Result<Record, WriteRefusal>
The body’s bits, then the pad: what Frame::parse reads back.
§Errors
The writer’s refusal: WriteRefusal.
Sourcepub fn envelope(
&self,
layout: &Layout,
stamp: Stamp,
) -> Result<Vec<u8>, WriteRefusal>
pub fn envelope( &self, layout: &Layout, stamp: Stamp, ) -> Result<Vec<u8>, WriteRefusal>
The put’s payload: the frame’s envelope, its tag the layout’s, its stamp record 0’s, then the body.
§Errors
Frame::write’s.
Sourcepub fn read_json(
&self,
layout: &Layout,
epoch: Option<i64>,
) -> Result<Value, ReadRefusal>
pub fn read_json( &self, layout: &Layout, epoch: Option<i64>, ) -> Result<Value, ReadRefusal>
The frame as spec/conformance/frame/bodies.json spells a value:
time, {"s", "ms"} or null, and records, each full, at
(after record 0: "scheduled" or its offset), values (the fields
included present, as §7.6’s JSON reading spells them) and absent
(those included absent, in field order).
§Errors
ReadRefusal::Code where a time field’s instant lies past an
i64 of milliseconds under epoch (packed::ReadRefusal::Epoch),
which no epoch within ±9.2 × 10^15 seconds gives.
Sourcepub fn from_json(
v: &Value,
layout: &Layout,
epoch: Option<i64>,
) -> Result<Frame, WriteRefusal>
pub fn from_json( v: &Value, layout: &Layout, epoch: Option<i64>, ) -> Result<Frame, WriteRefusal>
A frame from Frame::read_json’s spelling, each field’s value
coded as §7.6’s writer codes it. A full record’s optional field in
neither values nor absent is absent.
§Errors
The writer’s refusal: WriteRefusal.
Trait Implementations§
impl Eq for Frame
impl StructuralPartialEq for Frame
Auto Trait Implementations§
impl Forget for Frame
impl Freeze for Frame
impl Move for Frame
impl RefUnwindSafe for Frame
impl Send for Framewhere
RawVecInner: Send,
impl Sync for Framewhere
RawVecInner: Sync,
impl Unpin for Frame
impl UnsafeUnpin for Frame
impl UnwindSafe for Framewhere
RawVecInner: 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