petgraph_live/lib.rs
1//! `petgraph-live` — graph cache, snapshot, and algorithms for petgraph 0.8.
2//!
3//! # Features
4//!
5//! | Feature | Description |
6//! |---|---|
7//! | *(default)* | [`cache`], [`metrics`], [`connect`], [`shortest_path`], [`mst`] |
8//! | `snapshot` | Disk persistence via bincode or JSON |
9//! | `snapshot-zstd` | Zstd compression for snapshots (implies `snapshot`) |
10//! | `snapshot-lz4` | LZ4 compression via `lz4_flex` (implies `snapshot`) |
11//!
12//! Enabling `snapshot` also gates [`live`], which composes the cache with snapshot lifecycle.
13//!
14//! # Quick start
15//!
16//! ```rust
17//! use petgraph_live::cache::GenerationCache;
18//! use std::sync::Arc;
19//!
20//! let cache: GenerationCache<Vec<u32>> = GenerationCache::new();
21//! let g: Arc<Vec<u32>> = cache.get_or_build(1, || Ok::<_, ()>(vec![1, 2, 3])).unwrap();
22//! assert_eq!(*g, vec![1, 2, 3]);
23//! ```
24//!
25//! See [README](https://github.com/geronimo-iia/petgraph-live) for more examples.
26
27pub mod cache;
28pub mod connect;
29pub mod metrics;
30pub mod mst;
31pub mod shortest_path;
32
33#[cfg(feature = "snapshot")]
34pub mod snapshot;
35
36#[cfg(feature = "snapshot")]
37pub mod live;