Skip to main content

PeeBuilder

Struct PeeBuilder 

Source
#[non_exhaustive]
pub struct PeeBuilder { /* private fields */ }
Expand description

Builder for Pee. All chain methods are #[must_use].

§Examples

use rusty_pee::{PeeBuilder, CompatibilityMode};

let pee = PeeBuilder::new()
    .compat(CompatibilityMode::Default)
    .build()
    .expect("default builder always succeeds");

Implementations§

Source§

impl PeeBuilder

Source

pub fn new() -> Self

Construct a new builder defaulting to zero sinks, Default compat, capture(false), and ignore_write_errors(true).

Source

pub fn sink(self, sink: Box<dyn Write + Send>) -> Self

Register a sink. Sinks receive the same bytes in registration order.

Source

pub fn compat(self, compat: CompatibilityMode) -> Self

Set the compatibility mode.

Source

pub fn capture(self, capture: bool) -> Self

Set capture-mode flag. Library no-op (sinks already capture by definition); retained for parity with the CLI flag and validated against Strict mode at build time.

Source

pub fn ignore_write_errors(self, ignore: bool) -> Self

Set the ignore-write-errors policy. Default: true (matches moreutils --ignore-write-errors default-on behavior). When false, the first sink write error halts the fan-out and is surfaced as Error::SinkWriteFailed.

Source

pub fn build(self) -> Result<Pee, Error>

Validate and build a Pee.

Trait Implementations§

Source§

impl Debug for PeeBuilder

Source§

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

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

impl Default for PeeBuilder

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