Struct remoc::chmux::PortAllocator
source · pub struct PortAllocator(/* private fields */);
Expand description
Local port number allocator.
State is shared between clones of this type.
Implementations§
source§impl PortAllocator
impl PortAllocator
sourcepub async fn allocate(&self) -> PortNumber
pub async fn allocate(&self) -> PortNumber
Allocates a local port number.
Port numbers are allocated randomly. If all ports are currently in use, this waits for a port number to become available.
sourcepub fn try_allocate(&self) -> Option<PortNumber>
pub fn try_allocate(&self) -> Option<PortNumber>
Tries to allocate a local port number.
If all port are currently in use, this returns None.
Trait Implementations§
source§impl Clone for PortAllocator
impl Clone for PortAllocator
source§fn clone(&self) -> PortAllocator
fn clone(&self) -> PortAllocator
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for PortAllocator
impl RefUnwindSafe for PortAllocator
impl Send for PortAllocator
impl Sync for PortAllocator
impl Unpin for PortAllocator
impl UnwindSafe for PortAllocator
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