constcat 0.3.1

concat! with support for const variables and expressions
Documentation
<!-- Generated by cargo-onedoc. DO NOT EDIT. -->

# constcat

[![Crates.io Version](https://img.shields.io/crates/v/constcat.svg)](https://crates.io/crates/constcat)
[![Docs.rs Latest](https://img.shields.io/badge/docs.rs-latest-blue.svg)](https://docs.rs/constcat)
[![Build Status](https://img.shields.io/github/actions/workflow/status/rossmacarthur/constcat/build.yaml?branch=trunk)](https://github.com/rossmacarthur/constcat/actions/workflows/build.yaml?query=branch%3Atrunk)

[`std::concat!`] with support for `const` variables and expressions.

[`std::concat!`]: core::concat

Works on stable Rust ✨.

## 🚀 Getting started

Add `constcat` to your Cargo manifest.

```sh
cargo add constcat
```

Import the macro using the following.

```rust
use constcat::concat;
```

## 🤸 Usage

`concat!` works exactly like [`std::concat!`] except you can
now pass variables and constant expressions. For example:

```rust
const CRATE_NAME: &str = env!("CARGO_PKG_NAME");
const CRATE_VERSION: &str = env!("CARGO_PKG_VERSION");
const fn tada() -> &'static str { "🎉" }
const VERSION: &str = concat!(CRATE_NAME, " ", CRATE_VERSION, tada());
```

`concat_bytes!` works similarly except it yields a static byte slice. For
example:

```rust
const VERSION: u32 = 1;
const fn entries() -> &'static [u8] { b"example" }
const HEADER: &[u8] = concat_bytes!(&VERSION.to_le_bytes(), entries());
```

[`std::concat!`]: core::concat

## License

This project is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) for details.