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

Reserves capacity for at least additional more redirects to be backed up.

Applies changes to a given environment after backing up as appropriate.

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.

Restore all file descriptors to their original state.

Implementors