Expand description
§ialloc
Allocator interface traits for Rust
§Raison d’être
- Why not
core::alloc::Allocator/allocator_api?- 7+ years unstabilized and counting.
- I want container allocations this decade, thanks!
- We can aim to be compatible and interopable with it, if/when it stabilizes, or via separate nightly crates.
- Why not
core::alloc::GlobalAlloc?- Win32
FreeSidhas no equivalent arbitrary allocation function to implementGlobalAlloc::allocwith. bgfx::allochas no equivalent arbitrary free function to implementGlobalAlloc::deallocwith.- Split alloc/free/realloc traits will help avoid bugs and misuse!
- That said, we can aim to be compatible and interopable with it.
- Win32
- Rust-style traits are annoying to adapt to C-style allocators. This provides more C-friendly traits as options.
§Out of scope
- NUMA? Although ask again later.
- Physical GPU memory allocation, probably. Might warrant a related crate?
- ID/handle allocation, perhaps. Might warrant a related crate?
§License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
§Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
§Features
| Feature | Description | Additional Requirements |
|---|---|---|
| API Design | ||
"panicy“ | Implicitly panicy APIs | |
"panicy-bounds" | APIs that panic on out of bounds indicies | |
"panicy-memory" | APIs that panic when out of memory | |
| (always) | APIs that try to panic on undefined behavior |
|
| | Dependencies
| "alloc" | alloc crate support (rust standard library) |
| "std" | std crate support (rust standard library) |
| "msvc" | MSVC-specific library support | target_env =
| "msvc""win32" | Windows-specific allocators | target_os =
|
| | Language Standards
| "windows""c89" | C89 standard library support | cc finds a C89+ compatible compiler
| "c11" | C11 standard library support | cc finds a C11+ compatible compiler
| "c23" | C23 standard library support | cc finds a C23+ compatible compiler
|
| "c++98" | C++98 standard library support | cc finds a C++98+ compatible compiler
| "c++17" | C++17 standard library support | cc finds a C++17+ compatible compiler
Modules§
- _assumptions
- Assumptions
iallocmakes, likely resulting in unsoundness if broken. - allocator
- Allocator implementations
- boxed
alloc::boxed::Boxalternatives- error
ExcessiveAlignmentRequestedError,ExcessiveSliceRequestedError(and any future error types)- traits
- Allocator traits
- vec
alloc::vec::Vecalternatives