Movatterモバイル変換


[0]ホーム

URL:


concat_bytes

std

Macroconcat_bytes 

Source
macro_rules! concat_bytes {    ($($e:literal),+ $(,)?) => { ... };}
🔬This is a nightly-only experimental API. (concat_bytes #87555)
Expand description

Concatenates literals into a byte slice.

This macro takes any number of comma-separated literals, and concatenates them all intoone, yielding an expression of type&[u8; _], which represents all of the literalsconcatenated left-to-right. The literals passed can be any combination of:

  • byte literals (b'r')
  • byte strings (b"Rust")
  • arrays of bytes/numbers ([b'A', 66, b'C'])

§Examples

#![feature(concat_bytes)]lets:&[u8;6] =concat_bytes!(b'A',b"BC", [68,b'E',70]);assert_eq!(s,b"ABCDEF");

[8]ページ先頭

©2009-2026 Movatter.jp