pub struct Reader { /* private fields */ }Expand description
One key’s reader (core §7.7, “The reader’s fields”): what it holds of
the key’s frames, in the run it holds. A consumer or a tool keeps one
per frame key and hands it each frame in the order it arrived
(Reader::apply). A frame refused by its layout is never applied: its
body is not read, so neither its fields nor how many records it held
are known, and the next frame’s seq reads its records as lost, a gap
(core §7.7, “The frames it expects”: a seq newer than the one expected
follows records lost, whatever lost them; spec/conformance/frame/ apply.json reads a gap so). Reader::refuse notes it, so the next
frame says which of its lost records were refused (Applied::refused).
Implementations§
Source§impl Reader
impl Reader
Sourcepub fn new() -> Self
pub fn new() -> Self
A reader that holds nothing: its first frame is Follows::First.
Sourcepub fn refuse(&mut self, stamp: Stamp)
pub fn refuse(&mut self, stamp: Stamp)
Notes a frame at stamp whose layout refused it (core §7.7’s
refusals). It is never applied: the reader still expects the seq
after the last record it read, so the next frame follows a gap
counting the refused frame’s records, and lists its seq in
Applied::refused. A refused frame of a run it does not hold is
forgotten: the next frame of that run resets every field anyway.
Sourcepub fn follows(&self, layout: &Layout, stamp: Stamp) -> Follows
pub fn follows(&self, layout: &Layout, stamp: Stamp) -> Follows
What a frame at stamp would follow, read under layout.
Sourcepub fn apply(&mut self, layout: &Layout, stamp: Stamp, frame: &Frame) -> Applied
pub fn apply(&mut self, layout: &Layout, stamp: Stamp, frame: &Frame) -> Applied
Reads a frame of the key, stamp its envelope’s, frame its body
read under layout (Frame::parse): every field turns
unknown at a gap, a rewind and a run not held (its first frame
included), then each record is read in turn, a field known or
absent where included, carried where omitted with no deadband,
within under its deadband until max_records records after it
was included with a value, and unknown past it.
A reader holds one layout: a frame under another (another revision of the resource) is read as one of a run it does not hold.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Reader
impl Freeze for Reader
impl Move for Reader
impl RefUnwindSafe for Reader
impl Send for Readerwhere
RawVecInner: Send,
impl Sync for Readerwhere
RawVecInner: Sync,
impl Unpin for Reader
impl UnsafeUnpin for Readerwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Track>: UnsafeUnpin,
PhantomData<Seq>: UnsafeUnpin,
impl UnwindSafe for Readerwhere
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<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