Skip to main content

LineTerminator

Enum LineTerminator 

Source
#[non_exhaustive]
pub enum LineTerminator { Newline, CarriageReturn, }
Expand description

How the output pump decides where one captured/streamed line ends.

Set per stream on Command via line_terminator (both streams at once) or stdout_line_terminator / stderr_line_terminator. The default is Newline — the crate’s pre-1.0 behavior, splitting only on \n.

This is one shared definition of “a line” for the whole line-pumped path: what stdout_lines / output_events yield, what the per-line handlers (on_stdout_line) see, what a stdout_tee writes (each line followed by a \n), and what output_string joins. Choosing a mode moves all of them together — there is never a per-sink disagreement about what a line is.

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.
§

Newline

Split on \n only (the default, and the crate’s pre-1.0 behavior).

A \r immediately before a \n is a CRLF terminator and is stripped; every other \r — a lone one, or a run of them — is line content. Carriage-return progress output (a bar redrawn in place with \r, no \n until the very end) therefore accumulates as one ever-growing line: nothing is delivered until the final \n, and under a byte cap (with_max_bytes) that single over-cap line is dropped whole. Reach for CarriageReturn when you need such output live.

§

CarriageReturn

Treat a bare \r as a line terminator in addition to \n — “\r-aware” mode, for carriage-return progress output.

Each carriage-return frame is delivered as its own line the instant it is seen, so Progress: 50%\rProgress: 100%\n streams as the frames Progress: 50% then Progress: 100% — live, one at a time — instead of piling up as a single line that surfaces only at EOF. A \r\n pair stays a single terminator (it does not emit a spurious empty line between the \r and the \n), so ordinary CRLF text reads identically to Newline mode; only a \r not followed by a \n splits a frame.

The framing is the shared one described on the type: the handlers, the tee, the streaming verbs, and output_string all observe the same per-frame lines. It composes with the byte cap too — a frame whose content exceeds max_bytes is skipped as it arrives (never assembled whole), exactly as an over-cap \n line is, so a runaway \r-free frame cannot exhaust memory.

Trait Implementations§

Source§

impl Clone for LineTerminator

Source§

fn clone(&self) -> LineTerminator

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 Copy for LineTerminator

Source§

impl Debug for LineTerminator

Source§

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

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

impl Default for LineTerminator

Source§

fn default() -> LineTerminator

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

impl Eq for LineTerminator

Source§

impl PartialEq for LineTerminator

Source§

fn eq(&self, other: &LineTerminator) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LineTerminator

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> Any for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Source§

fn type_name(&self) -> &'static str

Source§

impl<T> AnySync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more