Constant const_panic::fmt::COMMA_SEP
source · pub const COMMA_SEP: Separator<'_>;
Available on crate feature
non_basic
only.Expand description
An alternate-flag-aware comma separator for use between fields or elements.
When the alternate flag is enabled, this puts each field/element on its own line.
Example
use const_panic::{
fmt::{self, FmtArg},
ArrayString,
flatten_panicvals,
};
// Debug formatting
assert_eq!(
const_panic::concat_!(FmtArg::DEBUG;
open: fmt::OpenBracket,
100u8, fmt::COMMA_SEP,
false, fmt::COMMA_SEP,
[0u16; 0], fmt::COMMA_SEP,
// fmt::COMMA_TERM always goes after the last field
debug: "really", fmt::COMMA_TERM,
close: fmt::CloseBracket,
),
"[100, false, [], \"really\"]"
);
// Alternate-Debug formatting
assert_eq!(
const_panic::concat_!(FmtArg::ALT_DEBUG;
open: fmt::OpenBracket,
100u8, fmt::COMMA_SEP,
false, fmt::COMMA_SEP,
[0u16; 0], fmt::COMMA_SEP,
// fmt::COMMA_TERM always goes after the last field
debug: "really", fmt::COMMA_TERM,
close: fmt::CloseBracket,
),
concat!(
"[\n",
" 100,\n",
" false,\n",
" [],\n",
" \"really\",\n",
"]",
)
);