https://github.com/bugadani/object-chain
Build ad-hoc Rust structures
https://github.com/bugadani/object-chain
Last synced: 8 months ago
JSON representation
Build ad-hoc Rust structures
- Host: GitHub
- URL: https://github.com/bugadani/object-chain
- Owner: bugadani
- License: mit
- Created: 2021-03-15T10:35:49.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-03-04T16:52:25.000Z (over 3 years ago)
- Last Synced: 2025-10-13T22:37:47.236Z (8 months ago)
- Language: Rust
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Object chain - build ad-hoc structures [](https://crates.io/crates/object-chain) [](https://docs.rs/object-chain/)
======================================
Object chains are static objects whose type depends on the objects you store in them.
This data structure is useful if you need to collect different objects that implement a common
functionality and you don't want heap allocation.
To get started, you need to create a `Chain` object by passing it your first object.
Use the `append` method to add more objects to your chain.
If you need to pass the chain around, you can use `impl ChainElement` or, if you need to be
explicit about the type, the `chain!` macro.
If you want to access the elements inside, you'll need to implement a common trait for your objects
and an accessor interface for `Chain` and `Link`. You can see an example in the source code.