PackageRegistry

Trait PackageRegistry 

Source
pub trait PackageRegistry: Send + Sync {
    type Version: VersionInfo + Clone + Send + Sync;
    type Metadata: PackageMetadata + Clone + Send + Sync;
    type VersionReq: Clone + Send + Sync;

    // Required methods
    fn get_versions<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Version>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_latest_matching<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
        req: &'life2 Self::VersionReq,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Self::Version>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn search<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
        limit: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Metadata>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Legacy package registry trait with associated types.

§Deprecation Notice

This trait is deprecated. Use Registry trait instead which uses trait objects (Box<dyn Version>) for better extensibility.

Required Associated Types§

Source

type Version: VersionInfo + Clone + Send + Sync

Version information type for this registry.

Source

type Metadata: PackageMetadata + Clone + Send + Sync

Metadata type for search results.

Source

type VersionReq: Clone + Send + Sync

Version requirement type (e.g., semver::VersionReq for Cargo, npm semver for npm).

Required Methods§

Source

fn get_versions<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Version>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetches all available versions for a package.

Source

fn get_latest_matching<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, name: &'life1 str, req: &'life2 Self::VersionReq, ) -> Pin<Box<dyn Future<Output = Result<Option<Self::Version>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Finds the latest version matching a version requirement.

Source

fn search<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 str, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Metadata>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Searches for packages by name or keywords.

Implementors§