pub struct OpenFiles { /* private fields */ }
Expand description
Represents the open files in a shell context.
Implementations§
Source§impl OpenFiles
impl OpenFiles
Sourcepub fn stdin(&self) -> Option<&OpenFile>
pub fn stdin(&self) -> Option<&OpenFile>
Retrieves the file backing standard input in this context.
Sourcepub fn stdout(&self) -> Option<&OpenFile>
pub fn stdout(&self) -> Option<&OpenFile>
Retrieves the file backing standard output in this context.
Sourcepub fn stderr(&self) -> Option<&OpenFile>
pub fn stderr(&self) -> Option<&OpenFile>
Retrieves the file backing standard error in this context.
Sourcepub fn remove(&mut self, fd: u32) -> Option<OpenFile>
pub fn remove(&mut self, fd: u32) -> Option<OpenFile>
Tries to remove an open file by its file descriptor. If the file descriptor
is not used, None
will be returned; otherwise, the removed file will
be returned.
Arguments:
fd
: The file descriptor to remove.
Sourcepub fn get(&self, fd: u32) -> Option<&OpenFile>
pub fn get(&self, fd: u32) -> Option<&OpenFile>
Tries to lookup the OpenFile
associated with a file descriptor. If the
file descriptor is not used, None
will be returned; otherwise, a reference
to the OpenFile
will be returned.
Arguments:
fd
: The file descriptor to lookup.
Sourcepub fn set(&mut self, fd: u32, file: OpenFile) -> Option<OpenFile>
pub fn set(&mut self, fd: u32, file: OpenFile) -> Option<OpenFile>
Associates the given file descriptor with the provided file. If the file descriptor
is already in use, the previous file will be returned; otherwise, None
will be returned.
Arguments:
fd
: The file descriptor to associate with the file.file
: The file to associate with the file descriptor.
Trait Implementations§
Source§impl IntoIterator for OpenFiles
impl IntoIterator for OpenFiles
Auto Trait Implementations§
impl Freeze for OpenFiles
impl RefUnwindSafe for OpenFiles
impl Send for OpenFiles
impl Sync for OpenFiles
impl Unpin for OpenFiles
impl UnwindSafe for OpenFiles
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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