pub struct SocketSet<'a> { /* private fields */ }
Expand description
An extensible set of sockets.
The lifetime 'a
is used when storing a Socket<'a>
.
Implementations§
§impl<'a> SocketSet<'a>
impl<'a> SocketSet<'a>
pub fn new<SocketsT>(sockets: SocketsT) -> SocketSet<'a>where
SocketsT: Into<ManagedSlice<'a, SocketStorage<'a>>>,
pub fn new<SocketsT>(sockets: SocketsT) -> SocketSet<'a>where SocketsT: Into<ManagedSlice<'a, SocketStorage<'a>>>,
Create a socket set using the provided storage.
pub fn add<T>(&mut self, socket: T) -> SocketHandlewhere
T: AnySocket<'a>,
pub fn add<T>(&mut self, socket: T) -> SocketHandlewhere T: AnySocket<'a>,
Add a socket to the set, and return its handle.
Panics
This function panics if the storage is fixed-size (not a Vec
) and is full.
pub fn get<T>(&self, handle: SocketHandle) -> &Twhere
T: AnySocket<'a>,
pub fn get<T>(&self, handle: SocketHandle) -> &Twhere T: AnySocket<'a>,
Get a socket from the set by its handle, as mutable.
Panics
This function may panic if the handle does not belong to this socket set or the socket has the wrong type.
pub fn get_mut<T>(&mut self, handle: SocketHandle) -> &mut Twhere
T: AnySocket<'a>,
pub fn get_mut<T>(&mut self, handle: SocketHandle) -> &mut Twhere T: AnySocket<'a>,
Get a mutable socket from the set by its handle, as mutable.
Panics
This function may panic if the handle does not belong to this socket set or the socket has the wrong type.
pub fn remove(&mut self, handle: SocketHandle) -> Socket<'a>
pub fn remove(&mut self, handle: SocketHandle) -> Socket<'a>
Remove a socket from the set, without changing its state.
Panics
This function may panic if the handle does not belong to this socket set.
Trait Implementations§
Auto Trait Implementations§
impl<'a> RefUnwindSafe for SocketSet<'a>
impl<'a> Send for SocketSet<'a>
impl<'a> Sync for SocketSet<'a>
impl<'a> Unpin for SocketSet<'a>
impl<'a> !UnwindSafe for SocketSet<'a>
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