NodeManager

Struct NodeManager 

Source
pub struct NodeManager<M: MacBackend> { /* private fields */ }
Expand description

One administrator’s dealings with one device.

Implementations§

Source§

impl<M: MacBackend> NodeManager<M>

Source

pub fn new(peer: PeerConnection<LocalNode<M>>, seed: u16) -> Self

Watch peer for Node Management responses.

seed picks the first token; anything unpredictable will do.

Source

pub fn device(&self) -> &PublicKey

The device being managed.

Source

pub fn send_options_mut(&mut self) -> &mut SendOptions

How requests go out. An acknowledgment is requested by default: it is what completes a reset, and elsewhere it turns an unreachable path into an early answer rather than four silent retries.

Source

pub fn stray(&self) -> u32

Payloads taken in that belonged to no outstanding exchange.

Source

pub fn counter(&self) -> u16

The counter behind the last token any exchange here consumed, the outstanding one included.

A caller that builds one manager per operation seeds the next one from this, so no token is ever issued twice against a device that holds answered tokens against retransmission.

Source

pub fn remaining(&self) -> Option<u32>

The device’s most recent estimate of octets not yet returned, present only during a continued read.

Source

pub fn is_busy(&self) -> bool

Whether an exchange is outstanding.

Source

pub fn begin(&mut self, request: &[u8], now_ms: u64) -> Result<(), BeginError>

Begin an operation carrying request, one ULCP frame.

The frame’s TID is ignored over this binding; the envelope token is what correlates the response.

Source

pub async fn service( &mut self, now_ms: u64, ) -> Result<Progress, ManagementError<<LocalNode<M> as Transport>::Error>>

Carry the outstanding exchange as far as it will go right now: take in whatever arrived, then send if an attempt is due.

A Done clears the exchange, leaving Self::reply readable until the next Self::begin.

Source

pub fn reply(&self) -> &[u8]

The reply frame of the exchange that just finished: one whole ULCP frame, its trailing content the concatenation of every fragment.

Auto Trait Implementations§

§

impl<M> Freeze for NodeManager<M>
where M: Freeze,

§

impl<M> !RefUnwindSafe for NodeManager<M>

§

impl<M> !Send for NodeManager<M>

§

impl<M> !Sync for NodeManager<M>

§

impl<M> Unpin for NodeManager<M>
where M: Unpin,

§

impl<M> !UnwindSafe for NodeManager<M>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

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> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.