From cd11aa44e2c41da68e05482ac607dca37545016b Mon Sep 17 00:00:00 2001 From: Jay Oster Date: Mon, 2 Oct 2023 11:57:44 -0700 Subject: [PATCH] Replace heapless with the much smaller arrayvec --- Cargo.toml | 2 +- README.md | 1 - src/lib.rs | 8 +++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3b0b20f..f6c77e9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,10 +44,10 @@ crate-type = ["staticlib", "cdylib"] [dependencies] anyhow = { version = "1.0.31", default-features = false } +arrayvec = { version = "0.7.4", default-features = false } crankstart-sys = { version = "0.1.2", path = "crankstart-sys" } euclid = { version = "0.22.9", default-features = false, features = [ "libm" ] } hashbrown = "0.14.0" -heapless = "0.6.1" [dev-dependencies] randomize = "3.0.1" diff --git a/README.md b/README.md index 8433ac8..67c9a4f 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,6 @@ crankstart-sys = { path = "../crankstart/crankstart-sys" } anyhow = { version = "1.0.31", default-features = false } euclid = { version = "0.22.9", default-features = false, features = [ "libm" ] } hashbrown = "0.14.0" -heapless = "0.6.1" [dependencies.cstr_core] version = "=0.1.2" diff --git a/src/lib.rs b/src/lib.rs index 4722d57..386d71b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -292,12 +292,10 @@ fn abort_with_addr(addr: usize) -> ! { #[panic_handler] fn panic(#[allow(unused)] panic_info: &PanicInfo) -> ! { - use { - core::fmt::Write, - heapless::{consts::*, String}, - }; + use arrayvec::ArrayString; + use core::fmt::Write; if let Some(location) = panic_info.location() { - let mut output: String = String::new(); + let mut output = ArrayString::<1024>::new(); let payload = if let Some(payload) = panic_info.payload().downcast_ref::<&str>() { payload } else {