Trait conch_runtime::env::RedirectEnvRestorer
[−]
[src]
pub trait RedirectEnvRestorer<E: ?Sized> { fn reserve(&mut self, additional: usize); fn apply_action(
&mut self,
action: RedirectAction<E::FileHandle>,
env: &mut E
) -> IoResult<()>
where
E: AsyncIoEnvironment + FileDescEnvironment,
E::FileHandle: From<FileDesc>; fn backup(&mut self, fd: Fd, env: &mut E); fn restore(&mut self, env: &mut E); }
An interface for maintaining 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.
Required Methods
fn reserve(&mut self, additional: usize)
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>,
&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)
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(&mut self, env: &mut E)
Restore all file descriptors to their original state.
Implementations on Foreign Types
impl<'a, T, E: ?Sized> RedirectEnvRestorer<E> for &'a mut T where
T: RedirectEnvRestorer<E>,
[src]
T: RedirectEnvRestorer<E>,
fn reserve(&mut self, additional: usize)
[src]
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>,
fn backup(&mut self, fd: Fd, env: &mut E)
[src]
fn restore(&mut self, env: &mut E)
[src]
Implementors
impl<E: ?Sized> RedirectEnvRestorer<E> for RedirectRestorer<E> where
E: FileDescEnvironment,
E::FileHandle: Clone,