DeviceEngine

Struct DeviceEngine 

Source
pub struct DeviceEngine<const PAYLOAD: usize, const ENTRIES: usize = CACHE_ENTRIES> { /* private fields */ }
Expand description

The device half of the Node Management binding.

PAYLOAD is the largest response payload the transport can carry, which is also the size of each retained entry. ENTRIES is how many administrators keep a retained response.

Implementations§

Source§

impl<const PAYLOAD: usize, const ENTRIES: usize> DeviceEngine<PAYLOAD, ENTRIES>

Source

pub fn new(nonce: u16) -> Self

Build an engine. nonce is drawn once per boot from the cryptographic RNG: it is what stops a cursor issued before a reboot from being honored after one, when the generation counter has started over.

Source

pub fn begin<'p>( &mut self, from: &PublicKey, payload: &'p [u8], generation: u16, now_ms: u64, out: &mut [u8], ) -> Ingress<'p>

Read an arriving Node Management Request payload, the payload type byte already stripped.

generation is the device-domain version: every change to it invalidates the cursors issued before it. now_ms orders the retained entries for eviction.

Source

pub fn complete( &mut self, produced: Produced<'_>, out: &mut [u8], ) -> Result<Option<usize>, CompleteError>

Wrap what the dispatch produced, retain it, and write the response payload into out.

Returns the payload’s length, or None for a reset-class command, which is answered by no payload at all.

Source

pub fn forget_retained(&mut self)

Forget every retained response, as a reset does.

Auto Trait Implementations§

§

impl<const PAYLOAD: usize, const ENTRIES: usize> Freeze for DeviceEngine<PAYLOAD, ENTRIES>

§

impl<const PAYLOAD: usize, const ENTRIES: usize> RefUnwindSafe for DeviceEngine<PAYLOAD, ENTRIES>

§

impl<const PAYLOAD: usize, const ENTRIES: usize> Send for DeviceEngine<PAYLOAD, ENTRIES>

§

impl<const PAYLOAD: usize, const ENTRIES: usize> Sync for DeviceEngine<PAYLOAD, ENTRIES>

§

impl<const PAYLOAD: usize, const ENTRIES: usize> Unpin for DeviceEngine<PAYLOAD, ENTRIES>

§

impl<const PAYLOAD: usize, const ENTRIES: usize> UnwindSafe for DeviceEngine<PAYLOAD, ENTRIES>

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.