Skip to main content

Frame

Struct Frame 

Source
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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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§

Source§

impl Clone for Frame

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 Frame

Source§

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

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

impl Eq for Frame

Source§

impl PartialEq for Frame

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 Frame

Auto Trait Implementations§

§

impl Forget for Frame

§

impl Freeze for Frame

§

impl Move for Frame

§

impl RefUnwindSafe for Frame

§

impl Send for Frame
where RawVecInner: Send,

§

impl Sync for Frame
where RawVecInner: Sync,

§

impl Unpin for Frame
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for Frame

§

impl UnwindSafe for Frame
where RawVecInner: 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> 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.