Struct conch_runtime::env::RedirectRestorer
[−]
[src]
pub struct RedirectRestorer<E: ?Sized> where
E: FileDescEnvironment, { /* fields omitted */ }
Maintains a state of all file descriptors that have been modified so that they can be restored later.
Note: the caller should take care that a restorer instance is always called with the same environment for its entire lifetime. Using different environments with the same restorer instance will undoubtedly do the wrong thing eventually, and no guarantees can be made.
Methods
impl<E: ?Sized> RedirectRestorer<E> where
E: FileDescEnvironment,
[src]
E: FileDescEnvironment,
fn new() -> Self
[src]
Create a new wrapper.
fn with_capacity(capacity: usize) -> Self
[src]
Create a new wrapper and reserve capacity for backing up the previous file descriptors of the environment.
fn reserve(&mut self, additional: usize)
[src]
: use the RedirectEnvRestorer
trait instead
Reserves capacity for at least additional
more redirects to be backed up.
fn apply_action(
&mut self,
action: RedirectAction<E::FileHandle>,
env: &mut E
) -> IoResult<()> where
E: AsyncIoEnvironment,
E::FileHandle: Clone + From<FileDesc>,
[src]
&mut self,
action: RedirectAction<E::FileHandle>,
env: &mut E
) -> IoResult<()> where
E: AsyncIoEnvironment,
E::FileHandle: Clone + From<FileDesc>,
: use the RedirectEnvRestorer
trait instead
Applies changes to a given environment after backing up as appropriate.
fn backup(&mut self, fd: Fd, env: &mut E) where
E::FileHandle: Clone,
[src]
E::FileHandle: Clone,
: use the RedirectEnvRestorer
trait instead
Backs up the original handle of specified file descriptor.
The original value of the file descriptor is the one the environment held before it was passed into this wrapper. That is, if a file descriptor is backed up multiple times, only the value before the first call could be restored later.
fn restore(self, env: &mut E)
[src]
: use the RedirectEnvRestorer
trait instead
Restore all file descriptors to their original state.
Trait Implementations
impl<E: Clone + ?Sized> Clone for RedirectRestorer<E> where
E: FileDescEnvironment,
E::FileHandle: Clone,
[src]
E: FileDescEnvironment,
E::FileHandle: Clone,
fn clone(&self) -> RedirectRestorer<E>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<E: ?Sized> Eq for RedirectRestorer<E> where
E: FileDescEnvironment,
E::FileHandle: Eq,
[src]
E: FileDescEnvironment,
E::FileHandle: Eq,
impl<E: ?Sized> PartialEq<Self> for RedirectRestorer<E> where
E: FileDescEnvironment,
E::FileHandle: PartialEq,
[src]
E: FileDescEnvironment,
E::FileHandle: PartialEq,
fn eq(&self, other: &Self) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<E: ?Sized> Debug for RedirectRestorer<E> where
E: FileDescEnvironment,
E::FileHandle: Debug,
[src]
E: FileDescEnvironment,
E::FileHandle: Debug,
impl<E: ?Sized> Default for RedirectRestorer<E> where
E: FileDescEnvironment,
[src]
E: FileDescEnvironment,
impl<E: ?Sized> RedirectEnvRestorer<E> for RedirectRestorer<E> where
E: FileDescEnvironment,
E::FileHandle: Clone,
[src]
E: FileDescEnvironment,
E::FileHandle: Clone,
fn reserve(&mut self, additional: usize)
[src]
Reserves capacity for at least additional
more redirects to be backed up.
fn apply_action(
&mut self,
action: RedirectAction<E::FileHandle>,
env: &mut E
) -> IoResult<()> where
E: AsyncIoEnvironment + FileDescEnvironment,
E::FileHandle: From<FileDesc>,
[src]
&mut self,
action: RedirectAction<E::FileHandle>,
env: &mut E
) -> IoResult<()> where
E: AsyncIoEnvironment + FileDescEnvironment,
E::FileHandle: From<FileDesc>,
Applies changes to a given environment after backing up as appropriate.
fn backup(&mut self, fd: Fd, env: &mut E)
[src]
Backs up the original handle of specified file descriptor. Read more
fn restore(&mut self, env: &mut E)
[src]
Restore all file descriptors to their original state.