pub struct FdReader { /* private fields */ }Expand description
Input function that reads from a file descriptor.
An instance of FdReader contains a SharedSystem to interact with the
file descriptor.
Although FdReader implements Clone, it does not mean you can create and
keep a copy of a FdReader instance to replay the input later. Since both
the original and clone share the same SharedSystem, reading a line from
one instance will affect the next read from the other.
Implementations§
Source§impl FdReader
impl FdReader
Sourcepub fn new(fd: Fd, system: SharedSystem) -> Self
pub fn new(fd: Fd, system: SharedSystem) -> Self
Creates a new FdReader instance.
The fd argument is the file descriptor to read from. It should be
readable, have the close-on-exec flag set, and remain open for the
lifetime of the FdReader instance.
Sourcepub fn set_echo(&mut self, echo: Option<Rc<Cell<State>>>)
👎Deprecated: use Echo instead
pub fn set_echo(&mut self, echo: Option<Rc<Cell<State>>>)
Sets the “echo” flag.
You can use this setter function to set a shared option state that
controls whether the input function echoes lines it reads to the
standard error. If echo is None or some shared cell containing
Off, the function does not echo. If a cell has On, the function
prints every line it reads to the standard error.
This option implements the behavior of the verbose shell option. You
can change the state of the shared cell through the lifetime of the
input function to reflect the option dynamically changed, which will
affect the next next_line call.
§Deprecation
This function is deprecated in favor of the Echo struct.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FdReader
impl !RefUnwindSafe for FdReader
impl !Send for FdReader
impl !Sync for FdReader
impl Unpin for FdReader
impl !UnwindSafe for FdReader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> InputObject for Twhere
T: Input,
impl<T> InputObject for Twhere
T: Input,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more