Skip to content

Commit 6c97a41

Browse files
authored
Reexport nix::Errno (#108)
* Reexport nix This is useful because the Error enum in its ApiError error variant exports that type, so in order to match on the error value it's necessary to use the same version of `nix` as this crate uses. The idiom in this case is to reexport `nix` (or reexporting `Errno` would likely be fine as well, but I'm not sure if `nix` leaks in other ways maybe so I propose exporting the entire `nix` to be sure that it's correct.) * Reexport only Errno
1 parent ed61660 commit 6c97a41

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

examples/rados_striper.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#[cfg(feature = "rados_striper")]
22
use {
3-
ceph::ceph as ceph_helpers, ceph::error::RadosError, nix::errno::Errno, std::env, std::str,
3+
ceph::ceph as ceph_helpers,
4+
ceph::error::{Errno, RadosError},
5+
std::env,
6+
std::str,
47
std::sync::Arc,
58
};
69

src/error.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ use uuid::Error as UuidError;
2525

2626
extern crate nix;
2727

28+
pub use nix::errno::Errno;
29+
2830
/// Custom error handling for the library
2931
#[derive(Debug)]
3032
pub enum RadosError {
3133
FromUtf8Error(FromUtf8Error),
3234
NulError(NulError),
3335
Error(String),
3436
IoError(Error),
35-
ApiError(nix::errno::Errno),
37+
ApiError(Errno),
3638
IntoStringError(IntoStringError),
3739
ParseIntError(ParseIntError),
3840
ParseBoolError(ParseBoolError),
@@ -139,6 +141,6 @@ impl From<Error> for RadosError {
139141
}
140142
impl From<i32> for RadosError {
141143
fn from(err: i32) -> RadosError {
142-
RadosError::ApiError(nix::errno::Errno::from_raw(-err))
144+
RadosError::ApiError(Errno::from_raw(-err))
143145
}
144146
}

0 commit comments

Comments
 (0)