Type Definition const_panic::fmt::ShortString[][src]

pub type ShortString = ArrayString<SHORT_STRING_CAP>;
This is supported on crate feature non_basic only.
Expand description

A stack allocated string type that’s convertible into PanicVal<'static>, with SHORT_STRING_CAP capacity.

Example

use const_panic::{
    fmt::ShortString,
    ArrayString, FmtArg, PanicVal,
};

let pv: PanicVal<'static> =
    PanicVal::write_short_str(ShortString::new("3,13,21,34,55,89"));

assert_eq!(ArrayString::<20>::from_panicvals(&[pv]).unwrap(), "3,13,21,34,55,89");


let pv_debug: PanicVal<'static> =
    PanicVal::from_short_str(ShortString::new("foo\n\0bar"), FmtArg::DEBUG);

assert_eq!(
    ArrayString::<20>::from_panicvals(&[pv_debug]).unwrap(),
    "\"foo\\n\\x00bar\"",
);