pub struct CrateNames(/* private fields */);Expand description
Reader for the names artifact (names-v1.tsv.zst): every crate name
with its default version and download rank.
Implementations§
Source§impl CrateNames
impl CrateNames
Sourcepub fn from_tsv(text: String) -> Result<Self, Error>
pub fn from_tsv(text: String) -> Result<Self, Error>
Parse an already-decompressed names artifact.
Sourcepub fn get(&self, name: &str) -> Option<Entry<'_>>
pub fn get(&self, name: &str) -> Option<Entry<'_>>
Name lookup, folded: case-insensitive, and - and _ are the same
character. get("Tokio_Util") finds tokio-util, because crates.io
would not have let a second crate claim that name.
Sourcepub fn entry_at(&self, index: usize) -> Option<Entry<'_>>
pub fn entry_at(&self, index: usize) -> Option<Entry<'_>>
The entry at line index (0-based, in the artifact’s folded-name sort
order), or None if out of range. Paired with len this
is the stable handle a caller needs to build a side index that refers
back into the artifact by position rather than copying names.
Sourcepub fn prefix_indices(&self, prefix: &str) -> Range<usize>
pub fn prefix_indices(&self, prefix: &str) -> Range<usize>
Sourcepub fn count(&self, prefix: &str) -> usize
pub fn count(&self, prefix: &str) -> usize
How many crate names start with prefix, folded as in get.
Two binary searches — no enumeration — so this is as cheap for "s"
as for "trillium-".
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CrateNames
impl RefUnwindSafe for CrateNames
impl Send for CrateNames
impl Sync for CrateNames
impl Unpin for CrateNames
impl UnsafeUnpin for CrateNames
impl UnwindSafe for CrateNames
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