Macro rustix::zstr
macro_rules! zstr {
($str:literal) => { ... };
}
Documentation
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 ZStr
s 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())?;