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 duplicate 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 UnsafeUnpin 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§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