Enum const_panic::fmt::TypeDelim [−][src]
pub enum TypeDelim {
Tupled,
Braced,
}
This is supported on crate feature
non_basic
only.Expand description
Whether a struct or variant is Tupled or Braced.
Unit structs/variants are considered braced.
Example
Formatting
use const_panic::{
fmt::{self, FmtArg, TypeDelim},
ArrayString,
flatten_panicvals,
};
{
let (open, close) = TypeDelim::Tupled.get_open_and_close();
assert_eq!(
ArrayString::<999>::from_panicvals(
&flatten_panicvals!(FmtArg::DEBUG;
"Foo",
open: open,
10u8, fmt::COMMA_SEP,
false, fmt::COMMA_TERM,
close: close,
)
).unwrap(),
"Foo(10, false)"
);
}
{
let (open, close) = TypeDelim::Braced.get_open_and_close();
assert_eq!(
ArrayString::<999>::from_panicvals(
&flatten_panicvals!(FmtArg::DEBUG;
"Bar",
open: open,
"x: ", debug: "hello", fmt::COMMA_SEP,
"y: ", true, fmt::COMMA_TERM,
close: close,
)
).unwrap(),
"Bar { x: \"hello\", y: true }"
);
}
Variants
A Foo(Bar)
type or variant
A Foo{bar: Baz}
type or variant