Skip to content

Create and Iterate over C compatible Linked Lists in Rust

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

Will-Shanks/linked_list_c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)] if yourStruct.next points to the next yourStruct
    • or use the impl_LlItem!([yourStruct, ...]) macro
  • Zero copy and minimal extra memory footprint (besides from<Vec> impl)
  • currently not quite no_std, but this could easily be made possible

About

Create and Iterate over C compatible Linked Lists in Rust

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages