Enum const_panic::fmt::TypeDelim
source · [−]pub enum TypeDelim {
Tupled,
Braced,
}
Available 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
Tupled
A Foo(Bar)
type or variant
Braced
A Foo{bar: Baz}
type or variant
Implementations
Trait Implementations
impl Copy for TypeDelim
impl Eq for TypeDelim
impl StructuralEq for TypeDelim
impl StructuralPartialEq for TypeDelim
Auto Trait Implementations
impl RefUnwindSafe for TypeDelim
impl Send for TypeDelim
impl Sync for TypeDelim
impl Unpin for TypeDelim
impl UnwindSafe for TypeDelim
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more