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

Gets the delimiters that surround the fields of a struct or variant.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.