find_package_by_name

Function find_package_by_name 

Source
pub fn find_package_by_name(name: &str) -> Option<PackageItem>
Expand description

What: Find a package by name in the official index and return it as a PackageItem.

Inputs:

  • name: Package name to search for

Output:

  • Some(PackageItem) if the package is found in the official index, None otherwise.

Details:

  • Uses the name_to_idx HashMap for O(1) lookup by lowercase name.
  • Falls back to linear scan if HashMap is empty (e.g., before rebuild).