FileDescEnv

Struct FileDescEnv 

Source
pub struct FileDescEnv<T> { /* private fields */ }
Expand description

An environment module for setting and getting shell file descriptors.

Implementations§

Source§

impl<T> FileDescEnv<T>

Source

pub fn new() -> Self

Constructs a new environment with no open file descriptors.

Source

pub fn with_capacity(capacity: usize) -> Self

Constructs a new environment with no open file descriptors, but with a specified capacity for storing open file descriptors.

Source

pub fn with_process_stdio() -> Result<Self>
where T: From<FileDesc>,

Constructs a new environment and initializes it with duplicated stdio file descriptors or handles of the current process.

Source

pub fn with_fds<I: IntoIterator<Item = (Fd, T, Permissions)>>(iter: I) -> Self

Constructs a new environment with a provided collection of provided file descriptors in the form (shell_fd, handle, permissions).

Trait Implementations§

Source§

impl<T> Clone for FileDescEnv<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for FileDescEnv<T>

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Default for FileDescEnv<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: Clone + Eq> FileDescEnvironment for FileDescEnv<T>

Source§

type FileHandle = T

A file handle (or wrapper) to associate with shell file descriptors.
Source§

fn file_desc(&self, fd: Fd) -> Option<(&Self::FileHandle, Permissions)>

Get the permissions and a handle associated with an opened file descriptor.
Source§

fn set_file_desc( &mut self, fd: Fd, handle: Self::FileHandle, perms: Permissions, )

Associate a file descriptor with a given handle and permissions.
Source§

fn close_file_desc(&mut self, fd: Fd)

Treat the specified file descriptor as closed for the current environment.
Source§

impl<T: PartialEq> PartialEq for FileDescEnv<T>

Source§

fn eq(&self, other: &FileDescEnv<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> SubEnvironment for FileDescEnv<T>

Source§

fn sub_env(&self) -> Self

Create a new sub-environment, which starts out idential to its parent, but any changes on the new environment will not be reflected on the parent.
Source§

impl<T: Eq> Eq for FileDescEnv<T>

Source§

impl<T> StructuralPartialEq for FileDescEnv<T>

Auto Trait Implementations§

§

impl<T> Freeze for FileDescEnv<T>

§

impl<T> RefUnwindSafe for FileDescEnv<T>
where T: RefUnwindSafe,

§

impl<T> Send for FileDescEnv<T>
where T: Sync + Send,

§

impl<T> Sync for FileDescEnv<T>
where T: Sync + Send,

§

impl<T> Unpin for FileDescEnv<T>

§

impl<T> UnwindSafe for FileDescEnv<T>
where T: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.