pub struct SeedTree { /* private fields */ }Expand description
Hierarchical, domain-keyed seed derivation.
SeedTree derives independent sub-seeds for each named subsystem using
FNV-1a hashing. The critical invariant: derive("fs") always returns the
same sub-seed regardless of what other domains are (or are not) derived.
let tree = SeedTree::new(42u64.into());
let fs_seed = tree.derive("fs");
let net_seed = tree.derive("net");
// Different domains produce different seeds
assert_ne!(fs_seed.to_u64(), net_seed.to_u64());
// Same domain + same master seed = same sub-seed (deterministic)
let tree2 = SeedTree::new(42u64.into());
assert_eq!(tree.derive("fs"), tree2.derive("fs"));Implementations§
Source§impl SeedTree
impl SeedTree
Sourcepub const fn new(master: VortexSeed) -> Self
pub const fn new(master: VortexSeed) -> Self
Create a new seed tree from a master seed.
Sourcepub fn derive(&self, domain: &str) -> VortexSeed
pub fn derive(&self, domain: &str) -> VortexSeed
Derive a sub-seed for a named domain.
Uses FNV-1a to mix the master seed bytes with the domain string.
The result is a new VortexSeed that is:
- Deterministic: same master + same domain = same output, always.
- Independent: changing the domain name changes the output completely.
Sourcepub fn subtree(&self, domain: &str) -> SeedTree
pub fn subtree(&self, domain: &str) -> SeedTree
Derive a sub-seed for a named domain, then create a child SeedTree
from it. Useful for hierarchical subsystems.
let root = SeedTree::new(42u64.into());
let fs_tree = root.subtree("fs");
let wal_seed = fs_tree.derive("wal");
let data_seed = fs_tree.derive("data");Sourcepub const fn master(&self) -> VortexSeed
pub const fn master(&self) -> VortexSeed
Get the master seed.
Auto Trait Implementations§
impl Freeze for SeedTree
impl RefUnwindSafe for SeedTree
impl Send for SeedTree
impl Sync for SeedTree
impl Unpin for SeedTree
impl UnsafeUnpin for SeedTree
impl UnwindSafe for SeedTree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more