pub struct FmtArg {
    pub indentation: u8,
    pub is_alternate: bool,
    pub fmt_kind: FmtKind,
    pub number_fmt: NumberFmt,
}Expand description
Carries all of the configuration for formatting functions.
§Example
use const_panic::{ArrayString, FmtArg, StdWrapper};
// `StdWrapper` wraps references to std types to provide their `to_panicvals` methods
const ARRAY: &[&str] = &["3", "foo\nbar", "\0qux"];
// Debug formatting
assert_eq!(
    const_panic::concat_!(FmtArg::DEBUG; ARRAY),
    r#"["3", "foo\nbar", "\x00qux"]"#
);
// Alternate-Debug formatting
assert_eq!(
    const_panic::concat_!(FmtArg::ALT_DEBUG; ARRAY),
    concat!(
        "[\n",
        "    \"3\",\n",
        "    \"foo\\nbar\",\n",
        "    \"\\x00qux\",\n",
        "]",
    )
);
// Display formatting
assert_eq!(
    const_panic::concat_!(FmtArg::DISPLAY; ARRAY),
    "[3, foo\nbar, \x00qux]"
);
// Alternate-Display formatting
assert_eq!(
    const_panic::concat_!(FmtArg::ALT_DISPLAY; ARRAY),
    concat!(
        "[\n",
        "    3,\n",
        "    foo\n",
        "bar,\n",
        "    \x00qux,\n",
        "]",
    )
);
Fields§
§indentation: u8How much indentation is needed for a field/array element.
Indentation is used by fmt::Delimiter
and by fmt::Separator,
when the is_alternate field flag is enabled.
is_alternate: boolWhether alternate formatting is being used.
fmt_kind: FmtKindWhether this is intended to be Display or Debug formatted.
number_fmt: NumberFmtWhat integers are formatted as: decimal, hexadecimal, or binary.
Implementations§
Source§impl FmtArg
 
impl FmtArg
Sourcepub const ALT_DISPLAY: Self
 
pub const ALT_DISPLAY: Self
A FmtArg with alternate Display formatting, starting with no indentation.
Sourcepub const ALT_DEBUG: Self
 
pub const ALT_DEBUG: Self
A FmtArg with alternate Debug formatting, starting with no indentation.
Sourcepub const ALT_BIN: Self
 
pub const ALT_BIN: Self
A FmtArg with alternate Debug and Binary formatting,
starting with no indentation.
Sourcepub const ALT_HEX: Self
 
pub const ALT_HEX: Self
A FmtArg with alternate Debug and Hexadecimal formatting,
starting with no indentation.
Sourcepub const fn set_alternate(self, is_alternate: bool) -> Self
 
pub const fn set_alternate(self, is_alternate: bool) -> Self
Sets whether alternate formatting is enabled
Sourcepub const fn set_display(self) -> Self
 
pub const fn set_display(self) -> Self
Changes the formatting to Display.