Crates.io | object-chain |
lib.rs | object-chain |
version | 0.1.3 |
source | src |
created_at | 2021-03-15 10:38:56.336055 |
updated_at | 2021-08-15 15:30:06.43996 |
description | Ad-hoc structure builder |
homepage | |
repository | https://github.com/bugadani/object-chain/ |
max_upload_size | |
id | 369189 |
size | 10,042 |
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.