pub struct DescriptorTable { /* private fields */ }
Expand description
Map of file handles to file descriptors. Typically owned by a
Thread
.
Implementations§
source§impl DescriptorTable
impl DescriptorTable
pub fn new() -> Self
sourcepub fn get(&self, idx: DescriptorHandle) -> Option<&Descriptor>
pub fn get(&self, idx: DescriptorHandle) -> Option<&Descriptor>
Get the descriptor at idx
, if any.
sourcepub fn get_mut(&mut self, idx: DescriptorHandle) -> Option<&mut Descriptor>
pub fn get_mut(&mut self, idx: DescriptorHandle) -> Option<&mut Descriptor>
Get the descriptor at idx
, if any.
sourcepub fn register_descriptor(
&mut self,
desc: Descriptor,
) -> Result<DescriptorHandle, Descriptor>
pub fn register_descriptor( &mut self, desc: Descriptor, ) -> Result<DescriptorHandle, Descriptor>
Register a descriptor and return its fd handle. Equivalent to
register_descriptor_with_min_fd(desc, 0)
. If the
descriptor could not be added, the descriptor is returned in the Err
.
sourcepub fn register_descriptor_with_min_fd(
&mut self,
desc: Descriptor,
min_fd: DescriptorHandle,
) -> Result<DescriptorHandle, Descriptor>
pub fn register_descriptor_with_min_fd( &mut self, desc: Descriptor, min_fd: DescriptorHandle, ) -> Result<DescriptorHandle, Descriptor>
Register a descriptor and return its fd handle. If the descriptor could not be added, the
descriptor is returned in the Err
.
sourcepub fn register_descriptor_with_fd(
&mut self,
desc: Descriptor,
new_fd: DescriptorHandle,
) -> Option<Descriptor>
pub fn register_descriptor_with_fd( &mut self, desc: Descriptor, new_fd: DescriptorHandle, ) -> Option<Descriptor>
Register a descriptor with a given fd handle and return the descriptor that it replaced.
sourcepub fn deregister_descriptor(
&mut self,
fd: DescriptorHandle,
) -> Option<Descriptor>
pub fn deregister_descriptor( &mut self, fd: DescriptorHandle, ) -> Option<Descriptor>
Deregister the descriptor with the given fd handle and return it.
sourcepub fn remove_all(&mut self) -> impl Iterator<Item = Descriptor>
pub fn remove_all(&mut self) -> impl Iterator<Item = Descriptor>
Remove and return all descriptors.
sourcepub fn remove_range(
&mut self,
range: impl RangeBounds<DescriptorHandle>,
) -> impl Iterator<Item = Descriptor>
pub fn remove_range( &mut self, range: impl RangeBounds<DescriptorHandle>, ) -> impl Iterator<Item = Descriptor>
Remove and return all descriptors in the range. If you want to remove all descriptors, you
should use remove_all
.
pub fn iter(&self) -> impl Iterator<Item = (&DescriptorHandle, &Descriptor)>
pub fn iter_mut( &mut self, ) -> impl Iterator<Item = (&DescriptorHandle, &mut Descriptor)>
Trait Implementations§
source§impl Clone for DescriptorTable
impl Clone for DescriptorTable
source§fn clone(&self) -> DescriptorTable
fn clone(&self) -> DescriptorTable
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 moresource§impl Default for DescriptorTable
impl Default for DescriptorTable
source§impl ExplicitDrop for DescriptorTable
impl ExplicitDrop for DescriptorTable
type ExplicitDropParam = Host
type ExplicitDropResult = ()
fn explicit_drop(self, host: &Host)
Auto Trait Implementations§
impl Freeze for DescriptorTable
impl !RefUnwindSafe for DescriptorTable
impl Send for DescriptorTable
impl Sync for DescriptorTable
impl Unpin for DescriptorTable
impl !UnwindSafe for DescriptorTable
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more