pub struct HeadlessIo {
pub output: Vec<String>,
/* private fields */
}Expand description
A NarjuIo that reads from a pre-set script and writes to a
buffer.
read_line pops the next scripted line, then reports EOF forever;
print appends to output (and, if constructed via
new_shared, to a shared sink readable after
the box has been consumed).
Fields§
§output: Vec<String>Everything printed so far, one entry per print call.
Implementations§
Source§impl HeadlessIo
impl HeadlessIo
Sourcepub fn new(input: Vec<String>) -> Self
pub fn new(input: Vec<String>) -> Self
Construct with the given input script and an empty output buffer.
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Construct with no input at all: read_line reports EOF
immediately. Sufficient for code that never calls read.
Like new, but also returns a shared handle to the print output, so
callers can read what a session printed after the Box<dyn NarjuIo>
has been consumed by TopLevel/EvalCtx.
Sourcepub fn drain_output(&mut self) -> Vec<String>
pub fn drain_output(&mut self) -> Vec<String>
Take everything printed so far, leaving the buffer empty.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HeadlessIo
impl !RefUnwindSafe for HeadlessIo
impl !Send for HeadlessIo
impl !Sync for HeadlessIo
impl Unpin for HeadlessIo
impl !UnwindSafe for HeadlessIo
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
Mutably borrows from an owned value. Read more