1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//! A shim crate for to import items of alloc crate ergonomically.
//!
//! [Examples](https://github.com/taiki-e/alloc-shim/tree/master/examples)
//!
//! ## Usage
//!
//! Add this to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! alloc-shim = "0.3.0"
//! ```
//!
//! Set the features so that `std` depends on `alloc-shim/std`, and `alloc` depends on `alloc-shim/alloc`:
//!
//! ```toml
//! [features]
//! std = ["alloc-shim/std"]
//! alloc = ["alloc-shim/alloc"]
//! ```
//!
//! Add this to your crate root (lib.rs or main.rs):
//!
//! ```rust,ignore
//! #![cfg_attr(feature = "alloc", feature(alloc))]
//! ```
//!
//! Now, you can use alloc-shim:
//!
//! ```rust
//! # #![cfg_attr(all(feature = "alloc", not(feature = "std")), feature(alloc))]
//! #[cfg(any(feature = "alloc", feature = "std"))]
//! use alloc::prelude::*; // And more...
//! ```
//!
//! The current version of alloc-shim requires Rust 1.31 or later.
//!
//! ## Crate Features
//!
//! If not either `std` or `alloc` is specified, this crate does nothing.
//!
//! * `std`
//! * Disabled by default.
//! * Enable to use `std` crate.
//!
//! * `alloc`
//! * Disabled by default.
//! * Enable to use `alloc` crate.
//! * Note that `std` crate is used if both `std` and `alloc` are specified at the same time.
//! * This requires Rust Nightly.
//!
//! * `futures`
//! * Disabled by default.
//! * Enable to use `alloc::task`.
//! * This requires Rust Nightly.
//!
extern crate alloc as liballoc;
pub use *;