pub struct PeerRepeatersResponseBuilder { /* private fields */ }Expand description
Builds the body of a MacCommand::PeerRepeatersResponse within a byte
budget, so a responder packs whatever fits and pages the rest.
The page’s own options are held as values rather than appended as they
arrive: they are emitted in key order at build, so a
responder that learns it needs a cursor only after packing stopped can
still add one.
Implementations§
Source§impl PeerRepeatersResponseBuilder
impl PeerRepeatersResponseBuilder
Sourcepub fn reserve_cursor(self, octets: usize) -> Self
pub fn reserve_cursor(self, octets: usize) -> Self
Hold back room for a cursor of octets, whose value is not known
until packing stops. Without it a response that fills its budget has
nowhere left to say where the next page begins.
Sourcepub fn cursor(self, cursor: &[u8]) -> Self
pub fn cursor(self, cursor: &[u8]) -> Self
Name where a follow-up request should resume. Omit on the final page.
Sourcepub fn try_push(
&mut self,
entry: &PeerRepeaterEntry<'_>,
) -> Result<bool, AppEncodeError>
pub fn try_push( &mut self, entry: &PeerRepeaterEntry<'_>, ) -> Result<bool, AppEncodeError>
Append one entry if it still fits the budget.
Returns whether it was taken, so a responder stops packing and issues a cursor at the first refusal rather than at a count it guessed.