Struct nrf_modem::LteLink

source ·
pub struct LteLink(/* private fields */);
Expand description

An object that keeps the modem connected. As long as there is an instance, the modem will be kept on. The drop function disables the modem if there is no link left.

Everything will work even if the user doesn’t use this directly. Every API that requires a network connection uses this internally.

However, this can lead to inefficiencies. For example, if you do a dns request and then make a socket to connect to the IP, the link will fall away in between.

The user can prevent this by creating his own instance that the user only drops when all network tasks are done.

Implementations§

source

pub async fn new() -> Result<Self, Error>

Create a new instance

While there is an instance of the LteLink, the modem is active. But that does not mean that there is access to the network.

Call this function to wait until there is a connection.

While there is an instance of the LteLink, the modem is active. But that does not mean that there is access to the network.

Call this function to wait until there is a connection.

source

pub async fn deactivate(self) -> Result<(), Error>

Deactivates Lte. This does the same as dropping the instance, but in an async manner.

Trait Implementations§

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

fn eq(&self, other: &LteLink) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

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>,

§

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>,

§

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.