Skip to main content

PrintOptions

Struct PrintOptions 

Source
pub struct PrintOptions {
Show 13 fields pub sep: String, pub end: String, pub style: Option<Style>, pub justify: Option<JustifyMethod>, pub overflow: Option<OverflowMethod>, pub no_wrap: Option<bool>, pub no_newline: bool, pub markup: Option<bool>, pub highlight: Option<bool>, pub highlighter: Option<Arc<dyn Highlighter>>, pub width: Option<usize>, pub crop: bool, pub soft_wrap: bool,
}
Expand description

Print options for controlling output.

Fields§

§sep: String

String to separate multiple objects.

§end: String

String to append at end.

§style: Option<Style>

Apply style to output.

§justify: Option<JustifyMethod>

Override justification.

§overflow: Option<OverflowMethod>

Override overflow handling.

§no_wrap: Option<bool>

Override no_wrap.

§no_newline: bool

Suppress newline.

§markup: Option<bool>

Parse markup.

§highlight: Option<bool>

Enable/disable highlighting (None = inherit Console setting).

§highlighter: Option<Arc<dyn Highlighter>>

Override the highlighter used when highlighting is enabled.

§width: Option<usize>

Override width.

§crop: bool

Crop output to width.

§soft_wrap: bool

Soft wrap at width.

Implementations§

Source§

impl PrintOptions

Source

pub fn new() -> Self

Create new print options with defaults.

Source

pub fn with_markup(self, markup: bool) -> Self

Set markup parsing.

Source

pub fn with_style(self, style: Style) -> Self

Set style.

Source

pub fn with_sep(self, sep: impl Into<String>) -> Self

Set the separator between objects.

Source

pub fn with_end(self, end: impl Into<String>) -> Self

Set the end string appended after output.

Source

pub fn with_justify(self, justify: JustifyMethod) -> Self

Override justification.

Source

pub fn with_overflow(self, overflow: OverflowMethod) -> Self

Override overflow handling.

Source

pub fn with_no_wrap(self, no_wrap: bool) -> Self

Override no_wrap.

Source

pub fn with_no_newline(self, no_newline: bool) -> Self

Suppress newline at end.

Source

pub fn with_highlight(self, highlight: bool) -> Self

Enable/disable highlighting.

Source

pub fn with_highlighter<H: Highlighter + 'static>(self, highlighter: H) -> Self

Override the highlighter for this print call.

Source

pub fn with_width(self, width: usize) -> Self

Override width.

Source

pub fn with_crop(self, crop: bool) -> Self

Crop output to width.

Source

pub fn with_soft_wrap(self, soft_wrap: bool) -> Self

Soft wrap at width.

Trait Implementations§

Source§

impl Clone for PrintOptions

Source§

fn clone(&self) -> PrintOptions

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 PrintOptions

Source§

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

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

impl Default for PrintOptions

Source§

fn default() -> PrintOptions

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