4 releases
0.1.2 | Mar 5, 2023 |
---|---|
0.1.1 | Feb 3, 2023 |
0.1.0 | Dec 31, 2022 |
0.0.1 | Dec 22, 2022 |
#2247 in Data structures
Used in 2 crates
13KB
237 lines
linked_list_c
This is a Rust crate with the goal of making C style linked lists easier to work with.
Some FFIs accept and/or return linked lists, requiring pointer wrangling and unsafe code to handle. This crate tries to take care of those ugly bits for you, and provide a safe and ergonomic interface instead
Features
- Easily create Lists that can be passed to C FFIs
- Safely iterate over a linked list received from a C FFI
- handles cleaning up List on drop
- can set a custom drop function if Drop, or libc::free() doesn't work for you
- extremely simple trait is all thats neccessary to use with your favorite struct
- just add
#[derive(LlItem)]
ifyourStruct.next
points to the nextyourStruct
- or use the
impl_LlItem!([yourStruct, ...])
macro
- just add
- Zero copy and minimal extra memory footprint (besides
from<Vec>
impl) - currently not quite no_std, but this could easily be made possible
Dependencies
~45–315KB