diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2020-10-16 21:11:37 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2020-10-16 21:11:37 +0200 |
commit | 68d0f47d145dc783106ba5f5ea670f7aa8ee31ff (patch) | |
tree | e59bb9bc129bc26ba0da2d62b9fa93a311e2f58f | |
parent | f60edb207431c61184b6c4a562159f98c83046d1 (diff) |
WIP: From and Into impl for Error typefrominto-error
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r-- | rust/kernel/src/error.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/rust/kernel/src/error.rs b/rust/kernel/src/error.rs index 95e322e39a88..ee849e2c9ef4 100644 --- a/rust/kernel/src/error.rs +++ b/rust/kernel/src/error.rs @@ -23,6 +23,20 @@ impl Error { } } +impl From<c_types::c_int> for Error { + fn from(errno: c_types::c_int) -> Self { + Error(errno) + } +} + +impl Into for Error { + type Target = c_types::c_int; + + fn into(self) -> Self::Target { + self.0 + } +} + impl From<TryFromIntError> for Error { fn from(_: TryFromIntError) -> Error { Error::EINVAL |