range-alloc

Latest version: 0.1.5 registry icon
Maintenance score
34
Safety score
100
Popularity score
71
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
0.1.5 0 0 0 0 0
0.1.4 0 0 0 0 0
0.1.3 0 0 0 0 0
0.1.2 0 0 0 0 0
0.1.1 0 0 0 0 0
0.1.0 0 0 0 0 0

Stability
Latest release:

0.1.5 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

Apache-2.0   -   Apache License 2.0

Not a wildcard

Not proprietary

OSI Compliant


MIT   -   MIT License

Not a wildcard

Not proprietary

OSI Compliant



range-alloc

A generic range allocator for Rust.

RangeAllocator<T> manages a contiguous range and hands out non-overlapping sub-ranges on request. It uses a best-fit strategy to reduce fragmentation and automatically merges adjacent free ranges on deallocation. Allocations can optionally be aligned to a given boundary without wasting the padding space.

Example

use range_alloc::RangeAllocator;

let mut alloc = RangeAllocator::new(0u64..1024);

// Basic allocation.
let a = alloc.allocate_range(256).unwrap();
assert_eq!(a, 0..256);

// Aligned allocation -- the returned range starts on a 128-byte boundary.
let b = alloc.allocate_range_aligned(64, 128).unwrap();
assert_eq!(b, 256..320);

// Free a range so it can be reused.
alloc.free_range(a);

// Grow the pool if you need more space.
alloc.grow_to(2048);

Minimum Supported Rust Version

The MSRV of this crate is at least 1.31, possibly earlier. It will only be bumped in a breaking release.

License

Licensed under either of

at your option.