embed-struct

Crates.ioembed-struct
lib.rsembed-struct
version0.1.1
created_at2025-12-15 17:15:14.47054+00
updated_at2025-12-31 18:40:23.535175+00
descriptionRust library for embedding data structures
homepagehttps://github.com/aegistudio/embed-struct
repository
max_upload_size
id1986400
size136,464
(aegistudio)

documentation

README

embed-struct

Rust library for embedding data structures.

CI Status MIT licensed

Overview

It's quite common to amalgamate multiple data structures in order to achieve complex functionalities:

  • Consider a LRU cache, it can be implemented by a HashMap from the keys to the cache items, plus a queue to track the recent visits to the cache items.
  • Consider a snake game, it can be implemented by a 2D grid with a queue of snake body embedded into it.
  • ...

Hand-rolling these embedded data structure might be repetitive and error prone, so many frameworks or libraries provide facilities to embed them. For example, in the linux kernel, they have macros like list_add*, list_del* to embed doubly linked lists, and macros like rb_link_node, rb_erase* to embed rbtrees.

And if you want to do the same embedding stuffs in rust, this is what the library aims to provide.

Commit count: 0

cargo fmt