pub struct OfficialIndex {
pub pkgs: Vec<OfficialPkg>,
pub name_to_idx: HashMap<String, usize>,
}Expand description
What: Represent the full collection of official packages maintained in memory.
Inputs:
- Populated by fetch and enrichment routines before being persisted or queried.
Output:
- Exposed through API helpers that clone or iterate the package list.
Details:
- Serializable via Serde to allow saving and restoring across sessions.
- The
name_to_idxfield is derived frompkgsand skipped during serialization.
Fields§
§pkgs: Vec<OfficialPkg>All known official packages in the process-wide index.
name_to_idx: HashMap<String, usize>Index mapping lowercase package names to their position in pkgs for O(1) lookups.
Skipped during serialization; rebuilt after deserialization via rebuild_name_index().
Implementations§
Source§impl OfficialIndex
impl OfficialIndex
Sourcepub fn rebuild_name_index(&mut self)
pub fn rebuild_name_index(&mut self)
What: Rebuild the name_to_idx HashMap from the current pkgs Vec.
Inputs:
- None (operates on
self.pkgs)
Output:
- Populates
self.name_to_idxwith lowercase package names mapped to indices.
Details:
- Should be called after deserialization or when
pkgsis modified. - Uses lowercase names for case-insensitive lookups.
Trait Implementations§
Source§impl Clone for OfficialIndex
impl Clone for OfficialIndex
Source§fn clone(&self) -> OfficialIndex
fn clone(&self) -> OfficialIndex
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OfficialIndex
impl Debug for OfficialIndex
Source§impl Default for OfficialIndex
impl Default for OfficialIndex
Source§fn default() -> OfficialIndex
fn default() -> OfficialIndex
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for OfficialIndex
impl<'de> Deserialize<'de> for OfficialIndex
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for OfficialIndex
impl RefUnwindSafe for OfficialIndex
impl Send for OfficialIndex
impl Sync for OfficialIndex
impl Unpin for OfficialIndex
impl UnwindSafe for OfficialIndex
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more