Introduce lifecycle-aware Layer::Empty variant and update callers
The `Layer` enum is transformed into a lifecycle-aware state machine with an `Empty` variant representing an unconstructed directory. Read and query operations now explicitly panic when invoked on this state, enforcing explicit progression through `create()` before use. Iterator methods are updated to handle the new variant exhaustively, and module visibility constants are adjusted to support the refactored structure.
This commit is contained in:
@@ -183,6 +183,7 @@ impl SiblingLayerExt for obilayeredmap::Layer {
|
||||
match self {
|
||||
obilayeredmap::Layer::Count(l) => l.iter_siblings(annex),
|
||||
obilayeredmap::Layer::Presence(l) => l.iter_siblings(annex),
|
||||
obilayeredmap::Layer::Empty { .. } => panic!("iter_siblings() called on an Empty layer"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,6 +191,7 @@ impl SiblingLayerExt for obilayeredmap::Layer {
|
||||
match self {
|
||||
obilayeredmap::Layer::Count(l) => l.iter_siblings_batch(annex, batch_size),
|
||||
obilayeredmap::Layer::Presence(l) => l.iter_siblings_batch(annex, batch_size),
|
||||
obilayeredmap::Layer::Empty { .. } => panic!("iter_siblings_batch() called on an Empty layer"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,6 +199,7 @@ impl SiblingLayerExt for obilayeredmap::Layer {
|
||||
match self {
|
||||
obilayeredmap::Layer::Count(l) => l.iter_minorants(annex),
|
||||
obilayeredmap::Layer::Presence(l) => l.iter_minorants(annex),
|
||||
obilayeredmap::Layer::Empty { .. } => panic!("iter_minorants() called on an Empty layer"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,6 +207,7 @@ impl SiblingLayerExt for obilayeredmap::Layer {
|
||||
match self {
|
||||
obilayeredmap::Layer::Count(l) => l.iter_minorants_batch(annex, batch_size),
|
||||
obilayeredmap::Layer::Presence(l) => l.iter_minorants_batch(annex, batch_size),
|
||||
obilayeredmap::Layer::Empty { .. } => panic!("iter_minorants_batch() called on an Empty layer"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user