pub struct SocketSet<const TIMER_HZ: u32, const N: usize, const L: usize> {
pub sockets: Vec<Option<Socket<TIMER_HZ, L>>, N>,
}Expand description
An extensible set of sockets.
Fields§
§sockets: Vec<Option<Socket<TIMER_HZ, L>>, N>Implementations§
Source§impl<const TIMER_HZ: u32, const N: usize, const L: usize> Set<TIMER_HZ, N, L>
impl<const TIMER_HZ: u32, const N: usize, const L: usize> Set<TIMER_HZ, N, L>
Sourcepub fn socket_type(&self, handle: Handle) -> Option<SocketType>
pub fn socket_type(&self, handle: Handle) -> Option<SocketType>
Get the type of a specific socket in the set.
Returned as a SocketType
Sourcepub fn add<T>(&mut self, socket: T) -> Result<Handle, Error>
pub fn add<T>(&mut self, socket: T) -> Result<Handle, Error>
Add a socket to the set with the reference count 1, and return its handle.
Sourcepub fn get<T: AnySocket<TIMER_HZ, L>>(
&mut self,
handle: Handle,
) -> Result<SocketRef<'_, T>, Error>
pub fn get<T: AnySocket<TIMER_HZ, L>>( &mut self, handle: Handle, ) -> Result<SocketRef<'_, T>, Error>
Get a socket from the set by its handle, as mutable.
pub fn recycle(&mut self, ts: Instant<TIMER_HZ>) -> bool
Trait Implementations§
Auto Trait Implementations§
impl<const TIMER_HZ: u32, const N: usize, const L: usize> Freeze for Set<TIMER_HZ, N, L>
impl<const TIMER_HZ: u32, const N: usize, const L: usize> RefUnwindSafe for Set<TIMER_HZ, N, L>
impl<const TIMER_HZ: u32, const N: usize, const L: usize> Send for Set<TIMER_HZ, N, L>
impl<const TIMER_HZ: u32, const N: usize, const L: usize> Sync for Set<TIMER_HZ, N, L>
impl<const TIMER_HZ: u32, const N: usize, const L: usize> Unpin for Set<TIMER_HZ, N, L>
impl<const TIMER_HZ: u32, const N: usize, const L: usize> UnwindSafe for Set<TIMER_HZ, N, L>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more