Skip to content

Commit 3e8d9b5

Browse files
committed
DOC: Add docs for nostd
1 parent aa0778a commit 3e8d9b5

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/lib.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,34 @@
1212
//! [`IndexSet`]: set/struct.IndexSet.html
1313
//!
1414
//!
15+
//!
1516
//! ## Rust Version
1617
//!
1718
//! This version of indexmap requires Rust 1.18 or later, or 1.30+ for
18-
//! development builds.
19+
//! development builds, and Rust 1.36+ for using with `alloc` (without `std`),
20+
//! see below.
1921
//!
2022
//! The indexmap 1.x release series will use a carefully considered version
2123
//! upgrade policy, where in a later 1.x version, we will raise the minimum
2224
//! required Rust version.
25+
//!
26+
//! ## No Standard Library Targets
27+
//!
28+
//! From Rust 1.36, this crate supports being built without `std`, requiring
29+
//! `alloc` instead. This is enabled automatically when it is detected that
30+
//! `std` is not available. There is no crate feature to enable/disable to
31+
//! trigger this. It can be tested by building for a std-less target.
32+
//!
33+
//! - Creating maps and sets using [`new`][IndexMap::new] and
34+
//! [`with_capacity`][IndexMap::with_capacity] is unavailable without `std`.
35+
//! Use methods [`IndexMap::default`][def],
36+
//! [`with_hasher`][IndexMap::with_hasher],
37+
//! [`with_capacity_and_hasher`][IndexMap::with_capacity_and_hasher] instead.
38+
//! A no-std compatible hasher will be needed as well, for example
39+
//! from the crate `twox-hash`.
40+
//! - Macros [`indexmap!`] and [`indexset!`] are unavailable without `std`.
41+
//!
42+
//! [def]: map/struct.IndexMap.html#impl-Default
2343
2444
#[cfg(not(has_std))]
2545
#[macro_use(vec)]

0 commit comments

Comments
 (0)