Crates.io | c-like-concat |
lib.rs | c-like-concat |
version | 0.0.5 |
source | src |
created_at | 2021-11-03 15:35:29.398575 |
updated_at | 2024-05-31 18:23:36.038168 |
description | simple macro that works just like C's ## |
homepage | |
repository | https://github.com/OrbitalStation/Old-Repositories/tree/cosmos/used-by-crates.io/c-like-concat |
max_upload_size | |
id | 476220 |
size | 2,434 |
use c_like_concat::concat;
#[derive(Debug, Eq, PartialEq)]
struct FuzzBuzz;
fn main() {
assert_eq!(concat!(0 ~ x ~ 42), 0x42);
assert_eq!(concat!(Fuzz ~ Buzz), FuzzBuzz);
// Sadly, but following code works
// as `stringify!` will expand to "concat! (Fuzz ~ Buzz)",
// not to "FuzzBuzz"
assert_eq!(stringify!(concat!(Fuzz ~ Buzz)), "concat! (Fuzz ~ Buzz)");
}