summaryrefslogtreecommitdiffstats
path: root/rust/kernel/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/kernel/src/error.rs')
-rw-r--r--rust/kernel/src/error.rs14
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