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]
impl<E: ?Sized> RedirectRestorer<E> where
E: FileDescEnvironment, pub fn new() -> Self[src]
pub fn new() -> SelfCreate a new wrapper.
pub fn with_capacity(capacity: usize) -> Self[src]
pub fn with_capacity(capacity: usize) -> SelfCreate a new wrapper and reserve capacity for backing up the previous file descriptors of the environment.
pub fn reserve(&mut self, additional: usize)[src]
pub fn reserve(&mut self, additional: usize): use the RedirectEnvRestorer trait instead
Reserves capacity for at least additional more redirects to be backed up.
pub fn apply_action(
&mut self,
action: RedirectAction<E::FileHandle>,
env: &mut E
) -> IoResult<()> where
E: AsyncIoEnvironment,
E::FileHandle: Clone + From<FileDesc>, [src]
pub fn apply_action(
&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.
pub fn backup(&mut self, fd: Fd, env: &mut E) where
E::FileHandle: Clone, [src]
pub fn backup(&mut self, fd: Fd, env: &mut E) where
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.
pub fn restore(self, env: &mut E)[src]
pub fn restore(self, env: &mut E): 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]
impl<E: Clone + ?Sized> Clone for RedirectRestorer<E> where
E: FileDescEnvironment,
E::FileHandle: Clone, fn clone(&self) -> RedirectRestorer<E>[src]
fn clone(&self) -> RedirectRestorer<E>Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl<E: ?Sized> Eq for RedirectRestorer<E> where
E: FileDescEnvironment,
E::FileHandle: Eq, [src]
impl<E: ?Sized> Eq for RedirectRestorer<E> where
E: FileDescEnvironment,
E::FileHandle: Eq, impl<E: ?Sized> PartialEq<Self> for RedirectRestorer<E> where
E: FileDescEnvironment,
E::FileHandle: PartialEq, [src]
impl<E: ?Sized> PartialEq<Self> for RedirectRestorer<E> where
E: FileDescEnvironment,
E::FileHandle: PartialEq, fn eq(&self, other: &Self) -> bool[src]
fn eq(&self, other: &Self) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
fn ne(&self, other: &Rhs) -> boolThis method tests for !=.
impl<E: ?Sized> Debug for RedirectRestorer<E> where
E: FileDescEnvironment,
E::FileHandle: Debug, [src]
impl<E: ?Sized> Debug for RedirectRestorer<E> where
E: FileDescEnvironment,
E::FileHandle: Debug, fn fmt(&self, fmt: &mut Formatter) -> Result[src]
fn fmt(&self, fmt: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl<E: ?Sized> Default for RedirectRestorer<E> where
E: FileDescEnvironment, [src]
impl<E: ?Sized> Default for RedirectRestorer<E> where
E: FileDescEnvironment, impl<E: ?Sized> RedirectEnvRestorer<E> for RedirectRestorer<E> where
E: FileDescEnvironment,
E::FileHandle: Clone, [src]
impl<E: ?Sized> RedirectEnvRestorer<E> for RedirectRestorer<E> where
E: FileDescEnvironment,
E::FileHandle: Clone, fn reserve(&mut self, additional: usize)[src]
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>, [src]
fn apply_action(
&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]
fn backup(&mut self, fd: Fd, env: &mut E)Backs up the original handle of specified file descriptor. Read more
fn restore(&mut self, env: &mut E)[src]
fn restore(&mut self, env: &mut E)Restore all file descriptors to their original state.
Auto Trait Implementations
impl<E: ?Sized> Send for RedirectRestorer<E> where
<E as FileDescEnvironment>::FileHandle: Send,
impl<E: ?Sized> Send for RedirectRestorer<E> where
<E as FileDescEnvironment>::FileHandle: Send, impl<E: ?Sized> Sync for RedirectRestorer<E> where
<E as FileDescEnvironment>::FileHandle: Sync,
impl<E: ?Sized> Sync for RedirectRestorer<E> where
<E as FileDescEnvironment>::FileHandle: Sync,