Macro rustix::zstr[][src]

macro_rules! zstr {
    ($str : literal) => { ... };
}
Expand description

A macro for ZStr literals.

This can make passing string literals to rustix APIs more efficient, since most underlying system calls with string arguments expect NUL-terminated strings, and passing strings to rustix as ZStrs means that rustix doesn’t need to copy them into a separate buffer to NUL-terminate them.

Examples

use rustix::fs::{cwd, statat, AtFlags};
use rustix::zstr;

let metadata = statat(&cwd(), zstr!("test.txt"), AtFlags::empty())?;