Crate hierr

source ·
Expand description

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

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

封装i32为Error

§Example

use hierr;

hierr::set_errno(100);
let err = hierr::Error::last();

println!("{}", err);

let mut buf = [0_u8; 64];
println!("{}: {}",  hierr::errno(), hierr::errmsg(hierr::errno(), &mut buf[..]));

assert_eq!(err, 100.into());
assert_eq!(hierr::errno(), 100);

Structs§

Constants§

Functions§

Type Aliases§