pub struct FormattedOutput { /* private fields */ }
Expand description
A value that has been formatted with Format
.
Formatting a value with Format
returns this opaque type rather than a string, since we need
to encapsulate the colors and text styles information in a cross-platform way. While ANSI escape
codes can be included in a string, other platforms (such as Windows) have their own mechanisms
for including colors and text styles in stdout/stderr.
Implementations§
Source§impl FormattedOutput
impl FormattedOutput
Sourcepub fn new<Value, Fmt>(value: Value, format: Fmt) -> Result<Self>where
Fmt: Format<Value = Value>,
pub fn new<Value, Fmt>(value: Value, format: Fmt) -> Result<Self>where
Fmt: Format<Value = Value>,
Create a new FormattedOutput
by formatting value
with format
.
Sourcepub fn indented(self, prefix: impl AsRef<str>) -> Self
pub fn indented(self, prefix: impl AsRef<str>) -> Self
Return a new FormattedOutput
which has been indented by prefix
.
To indent with whitespace, you can use whitespace
.
Sourcepub fn indented_hanging(self, prefix: impl AsRef<str>) -> Self
pub fn indented_hanging(self, prefix: impl AsRef<str>) -> Self
Return a new FormattedOutput
which has been indented by prefix
with a hanging indent.
This is the same as indented
, but generates a hanging indent.
Trait Implementations§
Source§impl Debug for FormattedOutput
impl Debug for FormattedOutput
Source§impl Display for FormattedOutput
impl Display for FormattedOutput
Source§impl From<FormattedFailure> for FormattedOutput
impl From<FormattedFailure> for FormattedOutput
Source§fn from(fail: FormattedFailure) -> Self
fn from(fail: FormattedFailure) -> Self
Converts to this type from the input type.
Source§impl<Pos, Neg> From<MatchFailure<Pos, Neg>> for FormattedOutput
impl<Pos, Neg> From<MatchFailure<Pos, Neg>> for FormattedOutput
Source§fn from(fail: MatchFailure<Pos, Neg>) -> Self
fn from(fail: MatchFailure<Pos, Neg>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for FormattedOutput
impl RefUnwindSafe for FormattedOutput
impl Send for FormattedOutput
impl Sync for FormattedOutput
impl Unpin for FormattedOutput
impl UnwindSafe for FormattedOutput
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