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
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ readme = "README.md"
documentation = "http://doc.servo.org/smallvec/"

[features]
heapsizeof = ["heapsize"]
heapsizeof = ["heapsize", "std"]
collections = []
std = []
default = ["std"]

[lib]
name = "smallvec"
Expand Down
15 changes: 15 additions & 0 deletions lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,24 @@
//! to the heap for larger allocations. This can be a useful optimization for improving cache
//! locality and reducing allocator traffic for workloads that fit within the inline buffer.

#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(not(feature = "std"), feature(collections))]


#[cfg(not(feature = "std"))]
extern crate collections;

#[cfg(not(feature = "std"))]
use collections::Vec;

#[cfg(feature="heapsizeof")]
extern crate heapsize;

#[cfg(not(feature = "std"))]
mod std {
pub use core::*;
}

use std::borrow::{Borrow, BorrowMut};
use std::cmp;
use std::fmt;
Expand Down