Fillet
A thin pointer based contiguous collection.
Fillet is null/zero when empty, making it ideal for scenarios where most collections are empty and you're storing many references to them.
It handles zero-sized types (ZSTs) without heap allocations, using usize for length.
Fillet is always pointer-sized and zero when empty.
Fillet does not reserve capacity, so repeated push operations can be slow as they always invoke the allocator and compute layouts.
However, Extend and FromIterator use amortized growth and perform similarly to Vec.
This crate is no_std.
Features
- Same stack size and alignment as a thin pointer.
- Very efficient for empty collections.
- Fast
from_iter/collectandextend, without reserved capacity. - Performance similar to
Vecin most cases. - No dependencies outside
coreandalloc.
Examples
Basic Usage
use Fillet;
let mut f: = from;
assert_eq!;
assert_eq!;
f.push;
assert_eq!;
f.truncate;
assert_eq!;
Zero-Sized Types
use Fillet;
use repeat_n;
use size_of;
let mut f: = repeat_n.collect;
assert_eq!;
// No heap allocation
f.push;
assert_eq!;
assert_eq!;
Extending from Within
use Fillet;
let mut f = from;
f.extend_from_within;
assert_eq!;
Minimum Supported Rust Version (MSRV)
Fillet has been verified to compile with Rust 1.85 and later.
Future versions might increase the Rust version requirement. It will not be treated as a breaking change, and as such can even happen with small patch releases.
License
Triple licensed, at your option:
- ISC license (LICENSE-ISC)
- 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)
Contribution
Contributions are welcome by pull request or email. Please feel free to add your name to the AUTHORS file in any substantive pull request.
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 licensed as above, without any additional terms or conditions.