Primitive type CtString
Implementations
impl CtString
pub comptime fn new() -> Self
pub comptime fn append_str<let N: u32>(self, s: str<N>) -> Self
pub comptime fn append_fmtstr<let N: u32, T>(self, s: fmtstr<N, T>) -> Self
pub comptime fn as_quoted_str(self) -> Quoted
CtString cannot directly return a str since the size would not be known.
To get around this, we return a quoted str and the underlying str can
be accessed using macro insertion foo.as_quoted_str!().
Trait implementations
impl Append for CtString
pub fn empty() -> Self
pub fn append(self, other: Self) -> Self
impl Eq for CtString
pub comptime fn eq(self, other: Self) -> bool
impl Hash for CtString
pub comptime fn hash<H>(self, state: &mut H)
where
H: Hasher
A a compile-time, dynamically-sized string type.
Compared to
str<N>andfmtstr<N, T>,CtStringis useful because its size does not need to be specified in its type. This can be used for formatting items at compile-time or general string handling incomptimecode.Since
fmtstrs can be converted intoCtStrings, you can make use of their formatting abilities in CtStrings by formatting infmtstrs then converting the result to a CtString afterward.