pub struct ReportAssembler<const N: usize> { /* private fields */ }Expand description
Reassembles a report that arrived as a series of chunks (§10.2.3).
N is the byte budget for the assembled answer. A whole-node wildcard read of a real
device is several kilobytes, so this is the one place in the crate where a caller has to
size a buffer against what it asked for rather than against a message: the answer is by
definition larger than any single message, or it would not have been chunked.
Implementations§
Source§impl<const N: usize> ReportAssembler<N>
impl<const N: usize> ReportAssembler<N>
Sourcepub const fn is_complete(&self) -> bool
pub const fn is_complete(&self) -> bool
Whether the last chunk has arrived.
Sourcepub const fn subscription_id(&self) -> Option<u32>
pub const fn subscription_id(&self) -> Option<u32>
The subscription this report belongs to, if any (§8.5.3.2).
Sourcepub fn push(&mut self, report: &ReportData<'_>) -> Result<bool>
pub fn push(&mut self, report: &ReportData<'_>) -> Result<bool>
Adds one chunk, returning whether the report is now complete.
false means another ReportData is coming — and that the server is waiting for a
StatusResponse before it sends one (§10.2.3).
ErrorCode::NoSpace means the answer is larger than N. Nothing partial is kept:
half a report is not a smaller report, it is a wrong one.
Sourcepub fn reports(&self) -> Reports<'_> ⓘ
pub fn reports(&self) -> Reports<'_> ⓘ
Every attribute report the answer carried, in the order it arrived.
Order is part of the answer: §10.6.4.3.1’s list encoding is a clearing block followed by its items, and reordering them would change what the list means.
Sourcepub fn assembled(&self) -> &[u8] ⓘ
pub fn assembled(&self) -> &[u8] ⓘ
The assembled answer as one Array element.
Valid TLV once ReportAssembler::is_complete, and forwardable verbatim — a bridge
relaying a report it does not understand needs exactly this.