c-like-concat

Crates.ioc-like-concat
lib.rsc-like-concat
version0.0.5
sourcesrc
created_at2021-11-03 15:35:29.398575
updated_at2024-05-31 18:23:36.038168
descriptionsimple macro that works just like C's ##
homepage
repositoryhttps://github.com/OrbitalStation/Old-Repositories/tree/cosmos/used-by-crates.io/c-like-concat
max_upload_size
id476220
size2,434
Orbital Station (OrbitalStation)

documentation

https://docs.rs/c_like_concat

README

Simple macro that works just like C's ##

The exception is that it uses the `~` sign instead of `##`

Example

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)");
}

Commit count: 0

cargo fmt