|
| 1 | +# range-alloc-arceos |
| 2 | + |
| 3 | +[](https://crates.io/crates/range-alloc-arceos) |
| 4 | +[](https://numpy1314.github.io/range-alloc) |
| 5 | +[](https://github.com/numpy1314/range-alloc/blob/main/LICENSE) |
| 6 | +[](https://github.com/numpy1314/range-alloc/actions/workflows/check.yml) |
| 7 | + |
| 8 | +**range-alloc-arceos** is a generic range allocator tailored for the ArceOS ecosystem. |
| 9 | + |
| 10 | +It is a fork of the excellent [gfx-rs/range-alloc](https://github.com/gfx-rs/range-alloc), adapted for use in kernel development and embedded scenarios (`no_std`). It allows you to dynamically allocate and free ranges from a predefined memory block or address space. |
| 11 | + |
| 12 | +## Features |
| 13 | + |
| 14 | +- **`no_std` Support**: Designed for bare-metal and kernel environments. |
| 15 | +- **Generic**: Works with any type that satisfies the `Range` requirements (e.g., memory addresses, port numbers). |
| 16 | +- **`markdown |
| 17 | +# range-alloc-arceos |
| 18 | + |
| 19 | +[](https://crates.io/crates/range-alloc-arceos) |
| 20 | +[](https://numpy1314.github.io/range-alloc) |
| 21 | +[](https://github.com/numpy1314/range-alloc/blob/main/LICENSE) |
| 22 | +[](https://github.com/numpy1314/range-alloc/actions/workflows/check.yml) |
| 23 | + |
| 24 | +**range-alloc-arceos** is a generic range allocator tailored for the ArceOS ecosystem. |
| 25 | + |
| 26 | +It is a fork of the excellent [gfx-rs/range-alloc](https://github.com/gfx-rs/range-alloc), adapted for use in kernel development and embedded scenarios (`no_std`). It allows you to dynamically allocate and free ranges from a predefined memory block or address space. |
| 27 | + |
| 28 | +## Features |
| 29 | + |
| 30 | +- **`no_std` Support**: Designed for bare-metal and kernel environments. |
| 31 | +- **Generic**: Works with any type that satisfies the `Range` requirements (e.g., memory addresses, port numbers). |
| 32 | +- **Efficient**: Merges adjacent free ranges to minimize fragmentation. |
| 33 | + |
| 34 | +## Usage |
| 35 | + |
| 36 | +Add this to your `Cargo.toml`: |
| 37 | + |
| 38 | +```toml |
| 39 | +[dependencies] |
| 40 | +range-alloc-arceos = "0.1.0-alpha.1" |
| 41 | +``` |
| 42 | + |
| 43 | +## Example |
| 44 | +```rust |
| 45 | +use range_alloc_arceos::RangeAllocator; |
| 46 | + |
| 47 | +fn main() { |
| 48 | + // Initialize the allocator with a range (e.g., 0..100) |
| 49 | + let mut allocator = RangeAllocator::new(0..100); |
| 50 | + |
| 51 | +} |
| 52 | + |
| 53 | +``` |
| 54 | + |
| 55 | +## License |
| 56 | +This project is licensed under either of |
| 57 | + |
| 58 | +- Apache License, Version 2.0, (LICENSE-APACHE |
| 59 | + or http://www.apache.org/licenses/LICENSE-2.0 |
| 60 | +) |
| 61 | + |
| 62 | +- MIT license (LICENSE-MIT |
| 63 | + or http://opensource.org/licenses/MIT |
| 64 | +) |
| 65 | + |
| 66 | +at your option. |
0 commit comments