pub struct SocketSet<'a, 'b: 'a, 'c: 'a + 'b> { /* private fields */ }
Expand description
An extensible set of sockets.
The lifetimes 'b
and 'c
are used when storing a Socket<'b, 'c>
.
Implementations§
source§impl<'a, 'b: 'a, 'c: 'a + 'b> Set<'a, 'b, 'c>
impl<'a, 'b: 'a, 'c: 'a + 'b> Set<'a, 'b, 'c>
sourcepub fn new<SocketsT>(sockets: SocketsT) -> Set<'a, 'b, 'c>where
SocketsT: Into<ManagedSlice<'a, Option<Item<'b, 'c>>>>,
pub fn new<SocketsT>(sockets: SocketsT) -> Set<'a, 'b, 'c>where
SocketsT: Into<ManagedSlice<'a, Option<Item<'b, 'c>>>>,
Create a socket set using the provided storage.
sourcepub fn add<T>(&mut self, socket: T) -> Handlewhere
T: Into<Socket<'b, 'c>>,
pub fn add<T>(&mut self, socket: T) -> Handlewhere
T: Into<Socket<'b, 'c>>,
Add a socket to the set with the reference count 1, and return its handle.
Panics
This function panics if the storage is fixed-size (not a Vec
) and is full.
sourcepub fn get<T: AnySocket<'b, 'c>>(&mut self, handle: Handle) -> SocketRef<'_, T>
pub fn get<T: AnySocket<'b, 'c>>(&mut self, handle: Handle) -> SocketRef<'_, T>
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.
sourcepub fn remove(&mut self, handle: Handle) -> Socket<'b, 'c>
pub fn remove(&mut self, handle: Handle) -> Socket<'b, 'c>
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.
sourcepub fn retain(&mut self, handle: Handle)
pub fn retain(&mut self, handle: Handle)
Increase reference count by 1.
Panics
This function may panic if the handle does not belong to this socket set.
sourcepub fn release(&mut self, handle: Handle)
pub fn release(&mut self, handle: Handle)
Decrease reference count by 1.
Panics
This function may panic if the handle does not belong to this socket set, or if the reference count is already zero.