Skip to content

Add no_std support #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2017
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