#c-str #clucompany #multiple-values #macro #no-std

macro no-std clucstr

Safe and efficient creation of "CStr" with zero-byte checking and support for concatenating multiple values

10 releases (3 stable)

1.2.0 May 7, 2024
1.1.91 Aug 22, 2019
0.1.7 Mar 3, 2019
0.1.6 Nov 10, 2018
0.1.3 Apr 16, 2018

#312 in FFI


Used in cluuname

Apache-2.0

16KB
260 lines

[clucstr]

( Safe and efficient creation of "CStr" with zero-byte checking and support for concatenating multiple values. )

Note:

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.

Usage:

Add this to your Cargo.toml:

[dependencies]
clucstr = "1.2.0"

and this to your source code:

use cluCStr::cstr;
use core::ffi::CStr;

Example:

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

License:

This project has a single license (LICENSE-APACHE-2.0).

uproject  Copyright (c) 2019-2024 #UlinProject

 (Denis Kotlyarov).


Apache License:

apache2  Licensed under the Apache License, Version 2.0.



Dependencies

~190–395KB