macro_rules! by_value_str {
    ($s:literal) => { ... };
}
Expand description

Construct a str from a string literal, in its dereferenced form.

Probably useless without the unsized_fn_params or unsized_locals nightly features.

Requires the alloc crate feature (though doesn’t actually allocate on the heap).

Example

#![feature(allocator_api, ptr_metadata, unsized_fn_params)]

use emplacable::{box_new, by_value_str};

let boxed_str: Box<str> = box_new(by_value_str!("why hello there"));
dbg!(&*boxed_str);