[−][src]Macro arcstr::literal_substr
feature = "substr"
: Create a const
Substr
.
This is a wrapper that initializes a Substr
over the entire contents of a
const
ArcStr
made using arcstr::literal!.
As with arcstr::literal
, these require no heap allocation, can be freely
cloned and used interchangeably with ArcStr
s from the heap, and are
effectively "free".
The main use case here is in applications where Substr
is a much more
common string type than ArcStr
.
Examples
use arcstr::{Substr, literal_substr}; // Works in const: const EXAMPLE_SUBSTR: Substr = literal_substr!("testing testing"); assert_eq!(EXAMPLE_SUBSTR, "testing testing"); // Or, just in normal expressions. assert_eq!("Wow!", literal_substr!("Wow!"));