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

无需 std clucstr

安全且高效地创建 "CStr",包含空字节检查和支持多值拼接

10 个版本 (3 个稳定版)

1.2.0 2024 年 5 月 7 日
1.1.91 2019 年 8 月 22 日
0.1.7 2019 年 3 月 3 日
0.1.6 2018 年 11 月 10 日
0.1.3 2018 年 4 月 16 日

#261 in FFI

Download history 154/week @ 2024-05-04 9/week @ 2024-05-11 2/week @ 2024-05-18 29/week @ 2024-06-29

每月 642 次下载
用于 cluuname

Apache-2.0

16KB
260

[clucstr]

( 安全且高效地创建 "CStr",包含空字节检查和支持多值拼接。 )

注意

从 Rust 1.77.0 开始,您可以使用 c"wow" 代替此 crate 中的 cstr!("wow")。这个新功能提供了更简洁的代码和更快的编译速度。如果您正在使用较旧的 Rust API(如 1.66),此 crate 仍将在一段时间内保持相关性。

用法

将其添加到您的 Cargo.toml 中

[dependencies]
clucstr = "1.2.0"

并将其添加到您的源代码中

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");
}
查看全部

许可证

此项目只有一个许可证(LICENSE-APACHE-2.0)。

uproject  版权所有 (c) 2019-2024 #UlinProject

 (Denis Kotlyarov).


Apache 许可证

apache2  根据 Apache License,版本 2.0 许可。



依赖项

~125–330KB