pub struct FdGuard {
pub(crate) fd: RawFd,
pub(crate) close_on_drop: AtomicBool,
}
Expand description
A RAII guard around a RawFd
that closes it automatically on drop.
Fields§
§fd: RawFd
§close_on_drop: AtomicBool
Implementations§
source§impl FdGuard
impl FdGuard
sourcepub fn should_not_close(&self)
pub fn should_not_close(&self)
Indicate that the wrapped file descriptor should not be closed when the guard is dropped.
This should be called in cases where ownership of the wrapped file descriptor has been “moved” out of the guard.
This is factored out into a separate function to ensure that it’s always used consistently.
Trait Implementations§
source§impl AsFd for FdGuard
impl AsFd for FdGuard
source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Borrows the file descriptor. Read more
source§impl FromRawFd for FdGuard
impl FromRawFd for FdGuard
source§unsafe fn from_raw_fd(fd: RawFd) -> Self
unsafe fn from_raw_fd(fd: RawFd) -> Self
Constructs a new instance of
Self
from the given raw file
descriptor. Read moresource§impl IntoRawFd for FdGuard
impl IntoRawFd for FdGuard
source§fn into_raw_fd(self) -> RawFd
fn into_raw_fd(self) -> RawFd
Consumes this object, returning the raw underlying file descriptor. Read more
Auto Trait Implementations§
impl !Freeze for FdGuard
impl RefUnwindSafe for FdGuard
impl Send for FdGuard
impl Sync for FdGuard
impl Unpin for FdGuard
impl UnwindSafe for FdGuard
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