[][src]Struct ublox_cellular::sockets::SocketSet

pub struct SocketSet<N, L> where
    N: ArrayLength<Option<Item<L>>>,
    L: ArrayLength<u8>, 
{ pub sockets: Vec<Option<Item<L>>, N>, }

An extensible set of sockets.

Fields

sockets: Vec<Option<Item<L>>, N>

Implementations

impl<N, L> Set<N, L> where
    N: ArrayLength<Option<Item<L>>>,
    L: ArrayLength<u8>, 
[src]

pub fn new() -> Set<N, L>[src]

Create a socket set using the provided storage.

pub fn capacity(&self) -> usize[src]

Get the maximum number of sockets the set can hold

pub fn len(&self) -> usize[src]

Get the current number of initialized sockets, the set is holding

pub fn is_empty(&self) -> bool[src]

Check if the set is currently holding no active sockets

pub fn socket_type(&self, handle: Handle) -> Option<SocketType>[src]

Get the type of a specific socket in the set.

Returned as a SocketType

pub fn add<T>(&mut self, socket: T) -> Result<Handle, Error> where
    T: Into<Socket<L>>, 
[src]

Add a socket to the set with the reference count 1, and return its handle.

pub fn get<T: AnySocket<L>>(
    &mut self,
    handle: Handle
) -> Result<SocketRef<'_, T>, Error>
[src]

Get a socket from the set by its handle, as mutable.

pub fn remove(&mut self, handle: Handle) -> Result<Socket<L>, Error>[src]

Remove a socket from the set, without changing its state.

pub fn retain(&mut self, handle: Handle) -> Result<(), Error>[src]

Increase reference count by 1.

pub fn release(&mut self, handle: Handle) -> Result<(), Error>[src]

Decrease reference count by 1.

pub fn prune(&mut self)[src]

Prune the sockets in this set.

Pruning affects sockets with reference count 0. Open sockets are closed. Closed sockets are removed and dropped.

pub fn iter(&self) -> impl Iterator<Item = (Handle, &Socket<L>)>[src]

Iterate every socket in this set.

pub fn iter_mut(
    &mut self
) -> impl Iterator<Item = (Handle, SocketRef<'_, Socket<L>>)>
[src]

Iterate every socket in this set, as SocketRef.

Trait Implementations

impl<N: Default, L: Default> Default for Set<N, L> where
    N: ArrayLength<Option<Item<L>>>,
    L: ArrayLength<u8>, 
[src]

Auto Trait Implementations

impl<N, L> RefUnwindSafe for Set<N, L> where
    <N as ArrayLength<Option<Item<L>>>>::ArrayType: RefUnwindSafe

impl<N, L> Send for Set<N, L>

impl<N, L> Sync for Set<N, L>

impl<N, L> Unpin for Set<N, L> where
    <N as ArrayLength<Option<Item<L>>>>::ArrayType: Unpin

impl<N, L> UnwindSafe for Set<N, L> where
    <N as ArrayLength<Option<Item<L>>>>::ArrayType: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.