pub struct ReadCursor { /* private fields */ }Expand description
Where a chunked read stopped, and where its next message resumes.
Core §10.2.3 splits a report “into multiple messages at logical boundaries due to the
size limitations imposed by IPv6 for UDP packets”, and §4.4.4 fixes that size at the
1280-octet IPv6 minimum MTU. A whole-node wildcard does not fit in one message and is not
supposed to: it is chunked, “maximally packing” information blocks into each message,
with MoreChunkedMessages set on every message but the last.
A cursor is three positions: which request path is being served, how far into that path’s
wildcard expansion, and — when one list attribute is itself too big for a message — how
many of its items have gone out. It is Copy and holds no borrows, so a device can park
one between messages while it waits for the StatusResponse that §10.2.3 requires
before the next chunk.
let mut cursor = ReadCursor::START;
while !cursor.is_done() {
let (bytes, outcome) = server.serve_chunk(
paths.iter().copied().map(Ok), &InteractionContext::default(),
None, &mut cursor, scratch, buf)?;
send(bytes);
// §10.2.3: "each data message requires a response before the next data message
// can be sent" — await the StatusResponse here.
let _ = outcome;
}Implementations§
Source§impl ReadCursor
impl ReadCursor
Sourcepub const fn set_event_from(&mut self, number: u64)
pub const fn set_event_from(&mut self, number: u64)
Starts the event half of a report at number (§8.5.3.4’s bookmark).
Sourcepub const fn event_from(&self) -> u64
pub const fn event_from(&self) -> u64
The lowest event number this cursor has not reported.
For a device driving Server::serve_chunk_with_events itself. A subscription’s
bookmark is kept by the subscription — Server::report_chunk records it and
Subscription::reported applies it — so that it
moves with what actually went out and no caller has to carry the number between the two.
Trait Implementations§
Source§impl Clone for ReadCursor
impl Clone for ReadCursor
Source§fn clone(&self) -> ReadCursor
fn clone(&self) -> ReadCursor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more