2 releases

0.1.1 May 25, 2023
0.1.0 May 23, 2023

#27 in #i32

MIT/Apache

7KB
97 lines

Error,基于i32错误码定义

包装OS的错误码, 统一错误码的查询和获取接口

  1. fn errno() -> i32;
  2. fn set_errno(i32);
  3. unsafe fn errmsg(i32) -> &str;

封装i32为Error

Example

use hun_error::*;

let err = Error::last_error();
assert_eq!(err, Error::default());

set_errno(100);
let err = Error::last_error();
assert_eq!(err, 100.into());

lib.rs:

包装OS的错误码, 统一错误码的查询和获取接口

  1. fn errno() -> i32;
  2. fn set_errno(i32);
  3. unsafe fn errmsg(i32) -> &str;

封装i32为Error

Example

use hun_error::*;

set_errno(100);
let err = Error::last_error();
assert_eq!(err, 100.into());

Dependencies

~4KB