Skip to content

Commit d51192f

Browse files
Merge pull request #3 from steffahn/make_features_additive
Make features additive
2 parents 0cab90d + 33f361c commit d51192f

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,9 @@ categories = ["no-std", "algorithms", "data-structures", "rust-patterns"]
1313
[dependencies]
1414

1515
[features]
16-
no_std = []
16+
default = ["alloc"]
17+
alloc = []
18+
19+
[package.metadata.docs.rs]
20+
all-features = true
21+
rustdoc-args = ["--generate-link-to-definition"]

src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
#![doc = include_str!("../README.md")]
22

33
#![no_std]
4+
#![cfg_attr(docsrs, feature(doc_cfg))]
45

56
use core::ptr::NonNull;
67
use core::mem::MaybeUninit;
78
use core::marker::PhantomData;
89

9-
#[cfg(not(feature = "no_std"))]
10+
#[cfg(feature = "alloc")]
1011
mod mut_cursor_vec;
11-
#[cfg(not(feature = "no_std"))]
12+
#[cfg(feature = "alloc")]
13+
#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))]
1214
pub use mut_cursor_vec::*;
1315

14-
#[cfg(not(feature = "no_std"))]
16+
#[cfg(feature = "alloc")]
1517
mod rooted_vec;
16-
#[cfg(not(feature = "no_std"))]
18+
#[cfg(feature = "alloc")]
19+
#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))]
1720
pub use rooted_vec::*;
1821

1922
/// Stores a stack of `&mut` references, only allowing access to the top element on the stack

src/mut_cursor_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ extern crate alloc;
55

66
/// Similar to [MutCursor](crate::MutCursor), but allows for a dynamically growing stack
77
///
8-
/// `MutCursorVec` is not available if the `no_std` feature is set
8+
/// `MutCursorVec` is not available if the `alloc` feature is disabled. (The feature is enabled by default.)
99
pub struct MutCursorVec<'root, T: ?Sized + 'root> {
1010
top: NonNull<T>,
1111
stack: alloc::vec::Vec<NonNull<T>>,

src/rooted_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ extern crate alloc;
1515
/// `MutCursorRootedVec` doesn't implement [Deref](core::ops::Deref), and accessors return [Option], so therefore it is
1616
/// allowed to be empty, unlike some of the other types in this crate.
1717
///
18-
/// `MutCursorRootedVec` is not available if the `no_std` feature is set
18+
/// `MutCursorRootedVec` is not available if the `alloc` feature is disabled. (The feature is enabled by default.)
1919
pub struct MutCursorRootedVec<RootT, NodeT: ?Sized> {
2020
top: Option<NonNull<NodeT>>,
2121
root: Option<RootT>,

0 commit comments

Comments
 (0)