Crates.io | clucstr |
lib.rs | clucstr |
version | 1.2.0 |
source | src |
created_at | 2018-04-15 21:40:49.206522 |
updated_at | 2024-05-07 22:00:03.460262 |
description | Safe and efficient creation of "CStr" with zero-byte checking and support for concatenating multiple values. |
homepage | |
repository | https://github.com/clucompany/cluCStr.git |
max_upload_size | |
id | 60810 |
size | 30,700 |
[clucstr]
( Safe and efficient creation of "CStr" with zero-byte checking and support for concatenating multiple values. )
You can use c"wow"
since Rust 1.77.0 instead of cstr!("wow")
from this crate. This new feature provides more concise code and faster compilation. If you are using an older Rust API (like 1.66), this crate will still be relevant for some time.
Add this to your Cargo.toml:
[dependencies]
clucstr = "1.2.0"
and this to your source code:
use cluCStr::cstr;
use core::ffi::CStr;
use cluCStr::cstr;
use core::ffi::CStr;
fn main() {
let cstr = cstr!(b"How are you?");
assert_eq!(cstr.to_bytes_with_nul(), b"How are you?\0");
}
See all
This project has a single license (LICENSE-APACHE-2.0).