pub struct OpenFiles { /* private fields */ }Expand description
Represents the open files in a shell context.
Implementations§
Source§impl OpenFiles
impl OpenFiles
Sourcepub fn update_from(&mut self, files: impl Iterator<Item = (ShellFd, OpenFile)>)
pub fn update_from(&mut self, files: impl Iterator<Item = (ShellFd, OpenFile)>)
Updates the open files from the provided iterator of (fd number, OpenFile) pairs.
Any existing entries for the provided file descriptors will be overwritten.
§Arguments
files: An iterator of (fd number,OpenFile) pairs to update the open files with.
Sourcepub fn try_stdin(&self) -> Option<&OpenFile>
pub fn try_stdin(&self) -> Option<&OpenFile>
Retrieves the file backing standard input in this context.
Sourcepub fn try_stdout(&self) -> Option<&OpenFile>
pub fn try_stdout(&self) -> Option<&OpenFile>
Retrieves the file backing standard output in this context.
Sourcepub fn try_stderr(&self) -> Option<&OpenFile>
pub fn try_stderr(&self) -> Option<&OpenFile>
Retrieves the file backing standard error in this context.
Sourcepub fn remove_fd(&mut self, fd: ShellFd) -> Option<OpenFile>
pub fn remove_fd(&mut self, fd: ShellFd) -> 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 try_fd(&self, fd: ShellFd) -> Option<&OpenFile>
pub fn try_fd(&self, fd: ShellFd) -> Option<&OpenFile>
Tries to lookup the OpenFile associated with a file descriptor.
Returns None if the file descriptor is not present.
Arguments:
fd: The file descriptor to lookup.
Sourcepub fn fd_entry(&self, fd: ShellFd) -> OpenFileEntry<'_>
pub fn fd_entry(&self, fd: ShellFd) -> OpenFileEntry<'_>
Tries to lookup the OpenFile associated with a file descriptor. Returns
an OpenFileEntry representing the state of the file descriptor.
Arguments:
fd: The file descriptor to lookup.
Sourcepub fn contains_fd(&self, fd: ShellFd) -> bool
pub fn contains_fd(&self, fd: ShellFd) -> bool
Checks if the given file descriptor is in use.
Sourcepub fn set_fd(&mut self, fd: ShellFd, file: OpenFile) -> Option<OpenFile>
pub fn set_fd(&mut self, fd: ShellFd, 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§
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