Expand description
A thin Rust wrapper library around libc errno interface.
§Examples
use chatora_errno::{clear_errno, describe_errno, get_errno, set_errno};
// Clear current errno.
clear_errno();
// Get the current value of errno.
let errno: i32 = get_errno();
assert_eq!(errno, 0);
// Equivalent to `clear_errno()`.
set_errno(0);
// Get string description of an errno.
let err_string: String = describe_errno(errno).unwrap();
assert_eq!(
format!("{} (os error {})", err_string, errno),
format!("{}", std::io::Error::from_raw_os_error(errno))
);
assert_eq!(err_string, "Success");Functions§
- clear_
errno - Sets
0value of errno. Equivalent toset_errno(0) - describe_
errno - Gets a detailed
Stringdescription for the given errno number. - get_
errno - Returns the value of errno.
- set_
errno - Sets the value of errno.