Registry / utility / ouroboros

ouroboros

JSON →
library0.18.5rscratesunverified

Easy, safe self-referential struct generation.

# Cargo.toml [dependencies] ouroboros = "0.18.5"
INSTALL
IMPORT
SIG · OUROBOROS
O
ouroboros
utilityrustv0.18.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

self_referencing
✓ use ouroboros::self_referencing;

Creates a self-referential struct with a borrowed view.

use ouroboros::self_referencing; #[self_referencing] struct MyStruct { data: String, #[borrows(data)] view: &'this str, } fn main() { let s = MyStructBuilder { data: "hello".to_string(), view_builder: |data: &str| &data[..2], }.build(); println!("{}", s.borrow_view()); }
Debug
Known issues
gotchaMacro-heavy; compile times may increase.
fix
Use sparingly or consider alternatives like `ouroboros`.
affects: >=0.18.0
Upgrade
Version history
0.18.5latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
10
Resources
ouroboros — cargo add ouroboros · libregistry