pub struct PnpClient<C: Clock, M, T: Transmitter<C>, R: Receiver<C>> { /* private fields */ }
Expand description

A plug-and-play allocation client that can be used to find a node ID

Implementations§

source§

impl<C, M, T, R, P> PnpClient<C, M, T, R>where C: Clock, M: AllocationMessage<P>, T: Transmitter<C, Transport = P>, R: Receiver<C, Transport = P>, P: Transport,

source

pub fn new( transmitter: T, receiver: R, unique_id: [u8; 16], driver: &mut R::Driver ) -> Result<Self, R::Error>

Creates a new plug-and-play client

  • unique_id: The unique ID of this node
source

pub fn send_request(&mut self, clock: &mut C, driver: &mut T::Driver)

Creates an outgoing node ID allocation message and gives it to the transmitter

source

pub fn receive( &mut self, clock: &mut C, driver: &mut R::Driver ) -> Result<Option<P::NodeId>, R::Error>

Handles an incoming frame and checks if it provides an ID for this node

This function returns the node ID if one was assigned.

source

pub fn transmitter(&self) -> &T

Returns a reference to the transmitter

source

pub fn transmitter_mut(&mut self) -> &mut T

Returns a mutable reference to the transmitter

source

pub fn receiver(&self) -> &R

Returns a reference to the receiver

source

pub fn receiver_mut(&mut self) -> &mut R

Returns a mutable reference to the receiver

Auto Trait Implementations§

§

impl<C, M, T, R> RefUnwindSafe for PnpClient<C, M, T, R>where M: RefUnwindSafe, R: RefUnwindSafe, T: RefUnwindSafe, <<C as Clock>::Instant as Instant>::Duration: RefUnwindSafe, <<T as Transmitter<C>>::Transport as Transport>::Priority: RefUnwindSafe, <<T as Transmitter<C>>::Transport as Transport>::TransferId: RefUnwindSafe,

§

impl<C, M, T, R> Send for PnpClient<C, M, T, R>where M: Send, R: Send, T: Send, <<C as Clock>::Instant as Instant>::Duration: Send, <<T as Transmitter<C>>::Transport as Transport>::Priority: Send, <<T as Transmitter<C>>::Transport as Transport>::TransferId: Send,

§

impl<C, M, T, R> Sync for PnpClient<C, M, T, R>where M: Sync, R: Sync, T: Sync, <<C as Clock>::Instant as Instant>::Duration: Sync, <<T as Transmitter<C>>::Transport as Transport>::Priority: Sync, <<T as Transmitter<C>>::Transport as Transport>::TransferId: Sync,

§

impl<C, M, T, R> Unpin for PnpClient<C, M, T, R>where M: Unpin, R: Unpin, T: Unpin, <<C as Clock>::Instant as Instant>::Duration: Unpin, <<T as Transmitter<C>>::Transport as Transport>::Priority: Unpin, <<T as Transmitter<C>>::Transport as Transport>::TransferId: Unpin,

§

impl<C, M, T, R> UnwindSafe for PnpClient<C, M, T, R>where M: UnwindSafe, R: UnwindSafe, T: UnwindSafe, <<C as Clock>::Instant as Instant>::Duration: UnwindSafe, <<T as Transmitter<C>>::Transport as Transport>::Priority: UnwindSafe, <<T as Transmitter<C>>::Transport as Transport>::TransferId: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · source§

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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.