|
2 | 2 | A cross-platform, fast, and safe general purpose C library written in Rust.
|
3 | 3 |
|
4 | 4 | The library is organized as a series of modules. The top level module `nstd` encompasses the entire
|
5 |
| -crate. Each module can have their own submodules (eg. `nstd.core.def` or `nstd::core::def` with |
| 5 | +crate. Each module can have their own submodules (eg. `nstd.io.stdout` or `nstd::io::stdout` with |
6 | 6 | Rust syntax).
|
7 | 7 |
|
8 | 8 | # Example using C
|
@@ -64,34 +64,36 @@ int main()
|
64 | 64 | `nstd.core` should support anything that rustc supports.
|
65 | 65 |
|
66 | 66 | `nstd.os`'s child modules will only work on the operating system they target. For example,
|
67 |
| -`nstd.os.windows` will only work on Windows and `nstd.os.linux` will only work on Linux |
68 |
| -distributions. |
| 67 | +`nstd.os.windows` will only work on Windows and `nstd.os.unix` will only work on Unix-like systems. |
69 | 68 |
|
70 | 69 | Other modules will work on most platforms, primarily targeting Windows, macOS,
|
71 | 70 | Linux, Android, and iOS.
|
72 | 71 |
|
73 | 72 | # Language support
|
74 |
| -This library can be accessed from any language that supports calling C code! As of now this will |
75 |
| -need to be done manually as there are no official wrappers for the API, however whenever library |
76 |
| -versioning occurs, the plan is to start adding official wrappers so developers from other languages |
| 73 | +This library can be accessed from any language that supports calling C code. As of now this will |
| 74 | +need to be done manually as there are no official wrappers for the API, however somewhere around |
| 75 | +version 0.11, the plan is to start adding official wrappers so developers from other languages |
77 | 76 | can easily use the API.
|
78 | 77 |
|
79 |
| -# Safety notes |
| 78 | +# User safety notes |
80 | 79 |
|
81 | 80 | - Raw pointers are unsafe to access.
|
82 | 81 |
|
83 |
| -- Raw pointer data is unsafe to mutate. |
84 |
| - |
85 |
| -- Any function that may cause undefined behavior must be marked unsafe. |
86 |
| - |
87 |
| -- Any operation that makes a direct call on a C function pointer is considered unsafe. |
| 82 | +- References are assumed to be valid (aligned, non-null, and non-dangling), and are safe to access. |
| 83 | +Users can refer to the [docs](https://docs.rs/nstd-sys/latest/nstd_sys/) to see which APIs expect |
| 84 | +or return valid references. |
88 | 85 |
|
89 | 86 | - The panic behavior is set to abort by default, as it is undefined behavior to unwind from Rust
|
90 | 87 | code into foreign code (though this is
|
91 | 88 | [subject to change](https://rust-lang.github.io/rfcs/2945-c-unwind-abi.html)).
|
92 | 89 |
|
93 |
| -- Reference arguments are assumed to be valid (aligned, non-null, and non-dangling), and are safe |
94 |
| -to access. |
| 90 | +# Contributor safety notes |
| 91 | + |
| 92 | +- Any operation that may cause undefined behavior must be marked unsafe. |
| 93 | + |
| 94 | +- Any operation that may cause data races must be marked unsafe. |
| 95 | + |
| 96 | +- Any operation that makes a direct call on a foreign C function pointer must be marked unsafe. |
95 | 97 |
|
96 | 98 | # How to build
|
97 | 99 | `nstd` lets you decide what features you want to use.
|
|
0 commit comments