Move result to libtock-rs
diff --git a/core/src/lang_items.rs b/core/src/lang_items.rs
index 6bbb257..4932420 100644
--- a/core/src/lang_items.rs
+++ b/core/src/lang_items.rs
@@ -18,7 +18,6 @@
 //! `rustc_main`. That's covered by the `_start` function in the root of this
 //! crate.
 
-use crate::result::TockResult;
 use crate::syscalls;
 use core::panic::PanicInfo;
 
@@ -40,7 +39,7 @@
     fn check_result(self) {}
 }
 
-impl Termination for TockResult<()> {
+impl<S, T> Termination for Result<S, T> {
     fn check_result(self) {
         if self.is_err() {
             unsafe { report_panic() };
diff --git a/core/src/result.rs b/core/src/result.rs
index 9dc4f16..9508738 100644
--- a/core/src/result.rs
+++ b/core/src/result.rs
@@ -1,23 +1,3 @@
-use core::fmt;
-
-pub type TockResult<T> = Result<T, TockError>;
-
-#[derive(Copy, Clone)]
-pub enum TockError {
-    Subscribe(SubscribeError),
-    Command(CommandError),
-    Allow(AllowError),
-    Format,
-    Other(OtherError),
-}
-
-#[cfg(not(any(target_arch = "arm", target_arch = "riscv32")))]
-impl core::fmt::Debug for TockError {
-    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
-        writeln!(f, "impl Debug only for test builds")
-    }
-}
-
 #[derive(Copy, Clone)]
 pub struct SubscribeError {
     pub driver_number: usize,
@@ -25,12 +5,6 @@
     pub return_code: isize,
 }
 
-impl From<SubscribeError> for TockError {
-    fn from(subscribe_error: SubscribeError) -> Self {
-        TockError::Subscribe(subscribe_error)
-    }
-}
-
 #[derive(Copy, Clone)]
 pub struct CommandError {
     pub driver_number: usize,
@@ -40,12 +14,6 @@
     pub return_code: isize,
 }
 
-impl From<CommandError> for TockError {
-    fn from(command_error: CommandError) -> Self {
-        TockError::Command(command_error)
-    }
-}
-
 #[derive(Copy, Clone)]
 pub struct AllowError {
     pub driver_number: usize,
@@ -53,42 +21,6 @@
     pub return_code: isize,
 }
 
-impl From<AllowError> for TockError {
-    fn from(allow_error: AllowError) -> Self {
-        TockError::Allow(allow_error)
-    }
-}
-
-impl From<fmt::Error> for TockError {
-    fn from(fmt::Error: fmt::Error) -> Self {
-        TockError::Format
-    }
-}
-
-#[derive(Copy, Clone)]
-pub enum OtherError {
-    ButtonsDriverInvalidState,
-    GpioDriverInvalidState,
-    TimerDriverDurationOutOfRange,
-    TimerDriverErroneousClockFrequency,
-    DriverAlreadyTaken,
-    OutOfRangeError,
-}
-
-impl From<OtherError> for TockError {
-    fn from(other: OtherError) -> Self {
-        TockError::Other(other)
-    }
-}
-
-pub struct OutOfRangeError;
-
-impl From<OutOfRangeError> for TockError {
-    fn from(_other: OutOfRangeError) -> Self {
-        TockError::Other(OtherError::OutOfRangeError)
-    }
-}
-
 pub const SUCCESS: isize = 0;
 pub const FAIL: isize = -1;
 pub const EBUSY: isize = -2;
diff --git a/src/lib.rs b/src/lib.rs
index 9ff7725..2ff6cca 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -15,6 +15,7 @@
 pub mod futures;
 pub mod gpio;
 pub mod leds;
+pub mod result;
 pub mod rng;
 pub mod sensors;
 pub mod simple_ble;
diff --git a/src/result.rs b/src/result.rs
new file mode 100644
index 0000000..74b4786
--- /dev/null
+++ b/src/result.rs
@@ -0,0 +1,69 @@
+use core::fmt;
+
+pub use libtock_core::result::*;
+
+pub type TockResult<T> = Result<T, TockError>;
+
+#[derive(Copy, Clone)]
+pub enum TockError {
+    Subscribe(SubscribeError),
+    Command(CommandError),
+    Allow(AllowError),
+    Format,
+    Other(OtherError),
+}
+
+#[cfg(not(any(target_arch = "arm", target_arch = "riscv32")))]
+impl core::fmt::Debug for TockError {
+    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
+        writeln!(f, "impl Debug only for test builds")
+    }
+}
+
+impl From<SubscribeError> for TockError {
+    fn from(subscribe_error: SubscribeError) -> Self {
+        TockError::Subscribe(subscribe_error)
+    }
+}
+
+impl From<CommandError> for TockError {
+    fn from(command_error: CommandError) -> Self {
+        TockError::Command(command_error)
+    }
+}
+
+impl From<AllowError> for TockError {
+    fn from(allow_error: AllowError) -> Self {
+        TockError::Allow(allow_error)
+    }
+}
+
+impl From<fmt::Error> for TockError {
+    fn from(fmt::Error: fmt::Error) -> Self {
+        TockError::Format
+    }
+}
+
+#[derive(Copy, Clone)]
+pub enum OtherError {
+    ButtonsDriverInvalidState,
+    GpioDriverInvalidState,
+    TimerDriverDurationOutOfRange,
+    TimerDriverErroneousClockFrequency,
+    DriverAlreadyTaken,
+    OutOfRangeError,
+}
+
+impl From<OtherError> for TockError {
+    fn from(other: OtherError) -> Self {
+        TockError::Other(other)
+    }
+}
+
+pub struct OutOfRangeError;
+
+impl From<OutOfRangeError> for TockError {
+    fn from(_other: OutOfRangeError) -> Self {
+        TockError::Other(OtherError::OutOfRangeError)
+    }
+}