Skip to main content

Capture

Enum Capture 

Source
#[non_exhaustive]
pub enum Capture { Discard, Inherit, Whole { limit: usize, over: OverLimit, }, Tail { limit: usize, }, Lines { queue: LineQueue, line: usize, total: usize, over: OverLimit, long: LongLine, end: u8, }, }
Expand description

What a run keeps of one output stream of the child.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Discard

The stream goes to the null device, and the run keeps nothing.

§

Inherit

The stream goes to the tool’s own stream, and the run keeps nothing.

A child in a group of its own is in the background of the terminal. It can write there unless the terminal has tostop set, and it is stopped when it reads. A stopped child holds a run with no deadline. For a step that the person answers, use Scope::Child with Input::Inherit, so the child stays in the tool’s foreground group and the tool carries on when it ends. Ctrl-C then reaches both.

§

Whole

The run keeps the stream’s first limit bytes. A stream longer than limit bytes is over its limit, and over says what the run does then.

Fields

§limit: usize

The most bytes that the run keeps.

§over: OverLimit

What the run does when the stream passes limit bytes.

§

Tail

The run reads the whole stream and keeps its last limit bytes.

Fields

§limit: usize

The most bytes that the run keeps.

§

Lines

The run splits the stream into lines on each end byte and pushes each line, without that byte, to queue while the child runs. A last line with no end is pushed when the stream ends. The run keeps no bytes in its Captured.

The first time the stream passes total bytes, the stream is over its limit, and over says what the run does then. No line is pushed after that. A line that passes line bytes does the same with LongLine::Over, and with LongLine::Skip the run drops that line alone and goes on.

Each queue serves one run, which ends it when it returns.

Fields

§queue: LineQueue

The queue that the run pushes each line to, from line_queue.

§line: usize

The most bytes of one line, without its end.

§total: usize

The most bytes of the whole stream, line ends and skipped lines included.

§over: OverLimit

What the run does when the stream passes a limit.

§long: LongLine

What a line longer than line bytes does.

§end: u8

The byte that ends a line, such as b'\n' or 0.

Trait Implementations§

Source§

impl Clone for Capture

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Capture

Source§

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

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

impl Default for Capture

Source§

fn default() -> Self

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

Auto Trait Implementations§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.