Struct Locked

Source
pub struct Locked<'invoker, 'buffer, B> { /* private fields */ }
Expand description

A network card on which methods can be invoked.

This type combined a network card address, and Invoker that can be used to make method calls, and a scratch buffer used to perform CBOR encoding and decoding. A value of this type can be created by calling Modem::lock, and it can be dropped to return the borrow of the invoker and buffer to the caller so they can be reused for other purposes.

The 'invoker lifetime is the lifetime of the invoker. The 'buffer lifetime is the lifetime of the buffer. The B type is the type of scratch buffer to use.

Implementations§

Source§

impl<'invoker, 'buffer, B: Buffer> Locked<'invoker, 'buffer, B>

Source

pub async fn is_wireless(&mut self) -> Result<bool, Error>

Checks whether this network card is wired or wireless.

§Errors
Source

pub async fn is_open(&mut self, port: NonZeroU16) -> Result<bool, Error>

Checks whether a specified port number accepts packets.

§Errors
Source

pub async fn open(&mut self, port: NonZeroU16) -> Result<bool, Error>

Starts accepting packets on a port number.

Returns true if the port was previously closed and is now open, or false if it was already open.

§Errors
Source

pub async fn close(&mut self, port: NonZeroU16) -> Result<bool, Error>

Stops accepting packets on a port number.

Returns true if the port was previously open and is now closed, or false if it was previously closed.

§Errors
Source

pub async fn close_all(&mut self) -> Result<bool, Error>

Stops accepting packets on all ports.

Returns true if any ports were previously open and are now closed, or false if all ports were previously closed.

§Errors
Source

pub async fn send( &mut self, destination: Address, port: NonZeroU16, parts: &[PacketPart<'_>], ) -> Result<(), Error>

Source

pub async fn broadcast( &mut self, port: NonZeroU16, parts: &[PacketPart<'_>], ) -> Result<(), Error>

Source

pub async fn get_strength(&mut self) -> Result<f64, Error>

Returns the current wireless transmit strength.

§Errors
Source

pub async fn set_strength(&mut self, strength: f64) -> Result<f64, Error>

Sets the wireless transmit strength.

Returns the new transmit strength, after clamping to the range permitted by the card.

§Errors
Source

pub async fn get_wake_message(self) -> Result<WakeMessage<'buffer>, Error>

Returns the wakeup message configuration.

§Errors
Source

pub async fn set_wake_message( self, config: WakeMessage<'_>, ) -> Result<WakeMessage<'buffer>, Error>

Sets the wakeup message configuration.

The old configuration is returned.

§Errors

Auto Trait Implementations§

§

impl<'invoker, 'buffer, B> Freeze for Locked<'invoker, 'buffer, B>

§

impl<'invoker, 'buffer, B> RefUnwindSafe for Locked<'invoker, 'buffer, B>
where B: RefUnwindSafe,

§

impl<'invoker, 'buffer, B> Send for Locked<'invoker, 'buffer, B>
where B: Send,

§

impl<'invoker, 'buffer, B> Sync for Locked<'invoker, 'buffer, B>
where B: Sync,

§

impl<'invoker, 'buffer, B> Unpin for Locked<'invoker, 'buffer, B>

§

impl<'invoker, 'buffer, B> !UnwindSafe for Locked<'invoker, 'buffer, B>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 T
where U: Into<T>,

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.