Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ repository = "https://github.com/servo/rust-smallvec"
description = "'Small vector' optimization: store up to a small number of items on the stack"
keywords = ["small", "vec", "vector", "stack", "no_std"]
categories = ["data-structures"]
readme = "README.md"
documentation = "https://docs.rs/smallvec/"
Comment thread
alejandro-vaz marked this conversation as resolved.
exclude = [".gitignore", "tests/", "fuzz/", "benches/", ".github/"]

[features]
Expand All @@ -21,15 +19,16 @@ serde = ["dep:serde_core"]
internals = []

[dependencies]
arbitrary = { version = "1", optional = true, default-features = false }
arbitrary = { version = "1.4", optional = true, default-features = false }
borsh = { version = "1.8", optional = true, default-features = false }
bytes = { version = "1", optional = true, default-features = false }
serde_core = { version = "1.0.221", optional = true, default-features = false }
malloc_size_of = { version = "0.1.1", optional = true, default-features = false }
bytes = { version = "1.12", optional = true, default-features = false }
defmt = { version = "1.1", optional = true, default-features = false}
serde_core = { version = "1.0", optional = true, default-features = false }
malloc_size_of = { version = "0.1", optional = true, default-features = false }

[dev-dependencies]
serde_test = "1.0"
criterion = "0.4.0"
criterion = "0.4"

[[test]]
name = "arbitrary"
Expand Down
17 changes: 15 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
#![cfg_attr(feature = "may_dangle", feature(dropck_eyepatch))]

#[doc(hidden)]
pub extern crate alloc;
extern crate alloc;

#[cfg(any(test, feature = "std"))]
#[cfg(feature = "std")]
extern crate std;

#[cfg(feature = "borsh")]
Expand All @@ -74,6 +74,12 @@ use bytes::{
BufMut,
buf::UninitSlice
};
#[cfg(feature = "defmt")]
use defmt::{
Format,
Formatter as DeFormatter,
write as dewrite
};
#[cfg(feature = "malloc_size_of")]
use malloc_size_of::{
MallocShallowSizeOf,
Expand Down Expand Up @@ -3201,3 +3207,10 @@ unsafe impl<const N: usize> BufMut for SmallVec<u8, N> {
self.resize(new_len, val);
}
}

#[cfg(feature = "defmt")]
impl<T: Format, const N: usize> Format for SmallVec<T, N> {
fn format(&self, fmt: DeFormatter) {
dewrite!(fmt, "{=[?]}", self.as_ref());
}
}
Loading