Crate pw_bytes

source ·
Expand description

pw_bytes is a collection of utilities for manipulating binary data.

§Features

pw_bytes contains the follow features:

  • macros for concatenating const [u8]s and &'static strs.

§Examples

use pw_bytes::concat_const_u8_slices;

// Concatenate two slices.
const SLICE_A: &[u8] = b"abc";
const SLICE_B: &[u8] = b"def";
const SLICE_AB: &[u8] = concat_const_u8_slices!(SLICE_A, SLICE_B);
assert_eq!(SLICE_AB, b"abcdef");
use pw_bytes::concat_static_strs;

// Concatenate two strings.
const STR_A: &'static str = "abc";
const STR_B: &'static str = "def";
const STR_AB: &'static str = concat_static_strs!(STR_A, STR_B);
assert_eq!(STR_AB, "abcdef");

Macros§