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
115
116
117
// Copyright (C) Jeeyong Um <conr2d@proton.me>
// Jungyong Um <ian.jungyong.um@gmail.com>
// SPDX-License-Identifier: MIT OR Apache-2.0
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! `nostd` provides essential `std`-like types in `no_std` environments.
//!
//! This crate re-exports types from the `alloc` and `core` crates under the
//! familiar `std` path while also offering alternative implementations for
//! types not available in those crates.
//!
//! `nostd` aims to help port code written for `std` to `no_std` with minimal
//! changes, often requiring only a replacement of `std::` with `nostd::`.
//!
//! ⚠️ **Warning:**
//! A successful build does not guarantee that the code will work as expected.
//! Exercise caution and thoroughly test your application before using it in
//! production.
//!
//! ## Features
//!
//! - `std::prelude` emulation
//! ```rs
//! use nostd::prelude::*;
//! // Now you can access `Box`, `String`, `Vec`, etc.
//! ```
//! - `std::io` emulation by [`core2`] (feature: `io`)
//! - `std::collections::hash_(map|set)` emulation by [`hashbrown`] (feature: `hashbrown`)
//!
//! [`core2`]: https://crates.io/crates/core2
//! [`hashbrown`]: https://crates.io/crates/hashbrown
//!
//! ## Usage
//!
//! Add this to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! nostd = "0.1"
//! ```
//!
//! By default, `nostd` is intended to be used in `no_std` environment. To use
//! it in `std` environment, enable the `std` feature:
//!
//! ```toml
//! [features]
//! default = ["std"]
//! std = ["nostd/std"]
//! ```
extern crate alloc as alloc_crate;
/// The nostd prelude
///
/// This module is intended for users of nostd where linking to std is not possible or desirable.
pub use *;
pub use *;
export!;
export!;
export!;
export!;
export!;
export!;
export!;
pub use io;