[−][src]Struct pathrs::Handle
A handle to an existing inode within a Root
.
This handle references an already-resolved path which can be used for the
purpose of "re-opening" the handle and get an actual File
which can be
used for ordinary operations.
Safety
It is critical for the safety of this library that at no point do you
use interfaces like libc::openat
directly on any RawFd
s you might
extract from the File
you get from this Handle
. You must always do
operations through a valid Root
.
Methods
impl Handle
[src]
pub fn reopen<F: Into<OpenFlags>>(&self, flags: F) -> Result<File, Error>
[src]
"Upgrade" the handle to a usable File
handle.
This new File
handle is suitable for reading and writing. This does
not consume the original handle (allowing for it to be used many times).
The File
handle will be opened with O_NOCTTY
and O_CLOEXEC
set,
regardless of whether those flags are present in the flags
argument.
You can correct these yourself if these defaults are not ideal for you:
fcntl(fd, F_SETFD, 0)
will let you unsetO_CLOEXEC
.ioctl(fd, TIOCSCTTY, 0)
will set the fd as the controlling terminal (if you don't have one already, and the fd references a TTY).
pub fn try_clone(&self) -> Result<Self, Error>
[src]
Create a copy of an existing Handle
.
The new handle is completely independent from the original, but references the same underlying file.
pub fn into_file(self) -> File
[src]
pub fn from_file_unchecked(inner: File) -> Self
[src]
Safety
The caller guarantees that the provided file is an O_PATH
file
descriptor with exactly the same semantics as one created through
Root::resolve
. This means that this function should usually be used
to convert a File
returned from Handle::into_file
(possibly from
another process) into a Handle
.
While this function is not marked as unsafe
(because the safety
guarantee required is not related to memory-safety), users should still
take great care when using this method because it can cause other kinds
of unsafety.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Handle
impl Send for Handle
impl Sync for Handle
impl Unpin for Handle
impl UnwindSafe for Handle
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,