tag | b07c264c6a0aed664a1671753fbc142c7788861e | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Tue Apr 23 15:27:29 2024 -0700 |
object | 7f903d5aaf8fc3eacd65d3134e08af8708f8aadc |
Platform Tools Release 35.0.1 (11580240)
commit | 7f903d5aaf8fc3eacd65d3134e08af8708f8aadc | [log] [tgz] |
---|---|---|
author | Inna Palant <ipalant@google.com> | Thu Mar 28 07:15:23 2024 +0000 |
committer | Inna Palant <ipalant@google.com> | Thu Mar 28 07:15:23 2024 +0000 |
tree | 3573475f73a671b7c7ccc797a56f36022bd28d61 | |
parent | a7f37af830760dbab9f4d42205ecfc872320af6a [diff] | |
parent | 8c877d7b057d06ea5bd2bd9628b0608a876d8f03 [diff] |
Merge remote-tracking branch 'origin/upstream'
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.