Remove unnecessary dummy Libtock struct and add alloc_error example
diff --git a/examples/alloc_error.rs b/examples/alloc_error.rs
new file mode 100644
index 0000000..ec42b5a
--- /dev/null
+++ b/examples/alloc_error.rs
@@ -0,0 +1,16 @@
+// Triggers the out-of-memory handler. Should make all LEDs cycle.
+
+#![no_std]
+
+extern crate alloc;
+
+use alloc::vec::Vec;
+use libtock::result::TockResult;
+
+#[libtock::main]
+fn main() -> TockResult<()> {
+ let mut vec = Vec::new();
+ loop {
+ vec.push(0);
+ }
+}
diff --git a/examples/panic.rs b/examples/panic.rs
index 6b476e3..5abc01a 100644
--- a/examples/panic.rs
+++ b/examples/panic.rs
@@ -1,9 +1,10 @@
+// Triggers the panic handler. Should make all LEDs flash.
+
#![no_std]
use libtock::result::TockResult;
#[libtock::main]
async fn main() -> TockResult<()> {
- let _ = libtock::LibTock {};
panic!("Bye world!");
}
diff --git a/src/lib.rs b/src/lib.rs
index a18f456..ec3ffd4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -34,7 +34,3 @@
pub(crate) mod drivers;
pub use drivers::*;
-
-/// Dummy structure to force importing the panic_handler and other no_std elements when nothing else
-/// is imported.
-pub struct LibTock;