pub struct MockRegistryIndex { /* private fields */ }Expand description
An in-memory index for testing that doesn’t require network access.
Implementations§
Source§impl MockRegistryIndex
impl MockRegistryIndex
pub fn new() -> Self
Sourcepub fn add_entry(&mut self, entry: PackageIndexEntry)
pub fn add_entry(&mut self, entry: PackageIndexEntry)
Register a package with its versions.
Sourcepub fn add_version(
&mut self,
name: &str,
version: &str,
checksum: &str,
pkg_type: PkgType,
dependencies: BTreeMap<String, String>,
yanked: bool,
)
pub fn add_version( &mut self, name: &str, version: &str, checksum: &str, pkg_type: PkgType, dependencies: BTreeMap<String, String>, yanked: bool, )
Add a single version to a package (creates the entry if needed).
Sourcepub fn fetch_package_versions(&self, name: &str) -> Result<PackageIndexEntry>
pub fn fetch_package_versions(&self, name: &str) -> Result<PackageIndexEntry>
Look up a package’s index entry.
Trait Implementations§
Source§impl Clone for MockRegistryIndex
impl Clone for MockRegistryIndex
Source§fn clone(&self) -> MockRegistryIndex
fn clone(&self) -> MockRegistryIndex
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 MockRegistryIndex
impl Debug for MockRegistryIndex
Source§impl Default for MockRegistryIndex
impl Default for MockRegistryIndex
Source§fn default() -> MockRegistryIndex
fn default() -> MockRegistryIndex
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MockRegistryIndex
impl RefUnwindSafe for MockRegistryIndex
impl Send for MockRegistryIndex
impl Sync for MockRegistryIndex
impl Unpin for MockRegistryIndex
impl UnsafeUnpin for MockRegistryIndex
impl UnwindSafe for MockRegistryIndex
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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