Crates.io | hierr |
lib.rs | hierr |
version | 0.2.2 |
source | src |
created_at | 2023-08-22 08:54:10.013634 |
updated_at | 2024-08-15 01:56:06.324771 |
description | RUST Error |
homepage | |
repository | https://gitcode.com/xuanwu/hierr |
max_upload_size | |
id | 950818 |
size | 32,240 |
原来的名字为hun_error
. 包装OS的错误码, 统一错误码的查询和获取接口
0.2.2
版本: 解决widows下无法正确输出中文信息的bug1. fn errno() -> i32;
2. fn set_errno(i32);
3. fn errmsg(i32, &mut [u8]) -> &str;
封装i32为Error
use hierr;
let err = hierr::Error::last();
println!("{}", err);
let mut buf = [0_u8; 64];
println!("{}: {}", hierr::errno(), hierr::errmsg(hierr::errno(), &mut buf[..]));
hierr::set_errno(100);
let err = hierr::Error::last();
assert_eq!(err, 100.into());
assert_eq!(hierr::errno(), 100);