commit | f9505a5efc9acf4003af1a16096510a3e9015b40 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <[email protected]> | Tue Sep 10 23:09:33 2024 +0000 |
committer | Android Build Coastguard Worker <[email protected]> | Tue Sep 10 23:09:33 2024 +0000 |
tree | d71f1188d7446cc0ecb1f8f2aa97926c66761ce0 | |
parent | d67587a1f454ec181c5e28c4b4e409d54f44423b [diff] | |
parent | 378118fb7ed9361dea0bc9b11aa783532d555d17 [diff] |
Snap for 12349386 from 378118fb7ed9361dea0bc9b11aa783532d555d17 to sdk-release Change-Id: I0a7d67be36b43860bb2e6c097fdd26ab69012690
Cross-platform interface to the errno
variable. Works on Rust 1.56 or newer.
Documentation is available at https://docs.rs/errno.
Add to your Cargo.toml
:
[dependencies] errno = "*"
std::io::Error
The standard library provides Error::last_os_error
which fetches errno
in the same way.
This crate provides these extra features:
#![no_std]
supportset_errno
functionextern crate errno; use errno::{Errno, errno, set_errno}; // Get the current value of errno let e = errno(); // Set the current value of errno set_errno(e); // Extract the error code as an i32 let code = e.0; // Display a human-friendly error message println!("Error {}: {}", code, e);
#![no_std]
Enable #![no_std]
support by disabling the default std
feature:
[dependencies] errno = { version = "*", default-features = false }
The Error
impl will be unavailable.