Crates.io | chstr |
lib.rs | chstr |
version | 0.1.0 |
source | src |
created_at | 2021-10-06 20:05:44.115858 |
updated_at | 2021-10-06 20:05:44.115858 |
description | A macro to convert a character array into a string at compile time. |
homepage | |
repository | https://github.com/Juici/chstr |
max_upload_size | |
id | 461335 |
size | 18,817 |
This library provides a macro to convert a sequence of characters into a string at compile time.
[dependencies]
chstr = "0.1"
Compiler support: requires rustc 1.57+
Basic usage:
const ABC: &str = chstr!['a', 'b', 'c'];
assert_eq!(ABC, "abc");
Directory separator:
const SEPARATOR_CHAR: char = std::path::MAIN_SEPARATOR;
const SEPARATOR: &str = chstr![SEPARATOR_CHAR];
let mut chars = SEPARATOR.chars();
assert_eq!(chars.next(), Some(SEPARATOR_CHAR));
assert_eq!(chars.next(), None);
This project is licensed under either of Apache License, Version 2.0 or MIT License at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.