MultiQueryDatabase

Struct MultiQueryDatabase 

Source
pub struct MultiQueryDatabase<'a, Querier> { /* private fields */ }
Expand description

Database to lookup queriers from their package names and repositories.

This type of database is designed for repository-aware use cases. For example: Multiple repositories whose packages may have duplicated names.

Implementations§

Source§

impl<'a, Querier: ShouldReuse> MultiQueryDatabase<'a, Querier>

Source

pub fn extend<PairIter>( &mut self, pairs: PairIter, ) -> Result<(), InsertError<'_>>
where Querier: Query<'a>, PairIter: IntoIterator<Item = (RepositoryName<'a>, Querier)>,

Extend the database with an iterator of tuples of a RepositoryName and an immutable querier of a desc file.

Old queriers which occupied the same pair of repository and name would be replaced.

Source

pub fn extend_mut<PairIter>( &mut self, pairs: PairIter, ) -> Result<(), InsertError<'_>>
where Querier: QueryMut<'a>, PairIter: IntoIterator<Item = (RepositoryName<'a>, Querier)>,

Extend the database with an iterator of tuples of a RepositoryName and a mutable querier of a desc file.

Old queriers which occupied the same pair of repository and name would be replaced.

Source

pub fn extend_newer<PairIter>( &mut self, pairs: PairIter, ) -> Result<(), InsertError<'_>>
where Querier: Query<'a>, PairIter: IntoIterator<Item = (RepositoryName<'a>, Querier)>,

Extend the database with an iterator of tuples of a RepositoryName and an immutable querier of a desc file.

An item from the iterator would replace an existing entry which occupied the same pair of repository and name if the iterator’s item has newer version than that of the existing entry.

Source

pub fn extend_newer_mut<PairIter>( &mut self, pairs: PairIter, ) -> Result<(), InsertError<'_>>
where Querier: QueryMut<'a>, PairIter: IntoIterator<Item = (RepositoryName<'a>, Querier)>,

Extend the database with an iterator of tuples of a RepositoryName and a mutable querier of a desc file.

An item from the iterator would replace an existing entry which occupied the same pair of repository and name if the iterator’s item has newer version than that of the existing entry.

Source§

impl<'a, Querier> MultiQueryDatabase<'a, Querier>

Source

pub fn get(&self, name: Name<'_>) -> Option<&MultiQuerier<'a, Querier>>

Get an immutable reference to a set of queriers of packages from different repositories by package name.

Source

pub fn get_mut( &mut self, name: Name<'_>, ) -> Option<&mut MultiQuerier<'a, Querier>>

Get a mutable reference to a set of queriers of packages from different repositories by package name.

Source§

impl<'a, Querier: ShouldReuse> MultiQueryDatabase<'a, Querier>

Source

pub fn insert( &mut self, repository: RepositoryName<'a>, querier: Querier, ) -> Result<Option<Attached<Querier, ParsedVersion<'a>>>, InsertError<'a>>
where Querier: Query<'a>,

Add an immutable querier of a desc file to the database.

If an older querier already occupied the same pair of name and repository, it will be returned inside Ok(Some(_)).

Source

pub fn insert_mut( &mut self, repository: RepositoryName<'a>, querier: Querier, ) -> Result<Option<Attached<Querier, ParsedVersion<'a>>>, InsertError<'a>>
where Querier: QueryMut<'a>,

Add a mutable querier of a desc file to the database.

If an older querier already occupied the same pair of name and repository, it will be returned inside Ok(Some(_)).

Source§

impl<'a, Querier: ShouldReuse> MultiQueryDatabase<'a, Querier>

Source

pub fn insert_newer( &mut self, repository: RepositoryName<'a>, querier: Querier, ) -> Result<InsertNewerReturn<'a, Querier>, InsertError<'a>>
where Querier: Query<'a>,

Add an immutable querier of a desc file to the database unless the entry was already occupied by a querier whose package version is not older than the provided querier.

Source

pub fn insert_newer_mut( &mut self, repository: RepositoryName<'a>, querier: Querier, ) -> Result<InsertNewerReturn<'a, Querier>, InsertError<'a>>
where Querier: QueryMut<'a>,

Add a mutable querier of a desc file to the database unless the entry was already occupied by a querier whose package version is not older than the provided querier.

Source§

impl<'a, Querier> MultiQueryDatabase<'a, Querier>

Source

pub fn entries(&self) -> MultiEntries<'_, 'a, Querier>

Get an iterator over all pairs of package names and immutable queriers.

Source

pub fn entries_mut(&mut self) -> MultiEntriesMut<'_, 'a, Querier>

Get an iterator over all pairs of package names and mutable queriers.

Source

pub fn latest_entries(&self) -> LatestEntries<'_, 'a, Querier>

Get an iterator over all pairs of package names and immutable queriers of the latest versions of each package.

Source

pub fn latest_entries_mut(&mut self) -> LatestEntriesMut<'_, 'a, Querier>

Get an iterator over all pairs of package names and mutable queriers of the latest versions of each package.

Source§

impl<'a, Querier: ShouldReuse> MultiQueryDatabase<'a, Querier>

Source

pub fn from_queriers<PairIter>(pairs: PairIter) -> Result<Self, InsertError<'a>>
where Querier: Query<'a>, PairIter: IntoIterator<Item = (RepositoryName<'a>, Querier)>,

Construct a database with an iterator of tuples of a RepositoryName and an immutable querier of a desc file.

If there are collisions between pairs of repository and name, the later pair would override the earlier.

Source

pub fn from_queriers_mut<PairIter>( pairs: PairIter, ) -> Result<Self, InsertError<'a>>
where Querier: QueryMut<'a>, PairIter: IntoIterator<Item = (RepositoryName<'a>, Querier)>,

Construct a database with an iterator of tuples of a RepositoryName and a mutable querier of a desc file.

If there are collisions between pairs of repository and name, the later pair would override the earlier.

Source

pub fn from_newer_queriers<PairIter>( pairs: PairIter, ) -> Result<Self, InsertError<'a>>
where Querier: Query<'a>, PairIter: IntoIterator<Item = (RepositoryName<'a>, Querier)>,

Construct a database with an iterator of tuples of a RepositoryName and an immutable querier of a desc file.

If there are collisions between pairs of repository and name, the one with newer package version would override the older.

Source

pub fn from_newer_queriers_mut<PairIter>( pairs: PairIter, ) -> Result<Self, InsertError<'a>>
where Querier: QueryMut<'a>, PairIter: IntoIterator<Item = (RepositoryName<'a>, Querier)>,

Construct a database with an iterator of tuples of a RepositoryName and a mutable querier of a desc file.

If there are collisions between pairs of repository and name, the one with newer package version would override the older.

Source§

impl<'a, Querier> MultiQueryDatabase<'a, Querier>

Source

pub fn names(&self) -> Names<'_, 'a, Querier>

Get an iterator over all package names.

Source§

impl<'a, Querier> MultiQueryDatabase<'a, Querier>

Source

pub fn queriers(&self) -> MultiQueriers<'_, 'a, Querier>

Get an iterator over all immutable queriers.

Source

pub fn queriers_mut(&mut self) -> MultiQueriersMut<'_, 'a, Querier>

Get an iterator over all mutable queriers.

Source

pub fn latest_queriers(&self) -> LatestQueriers<'_, 'a, Querier>

Get an iterator over all immutable queriers of the latest versions of each package.

Source

pub fn latest_queriers_mut(&mut self) -> LatestQueriersMut<'_, 'a, Querier>

Get an iterator over all mutable queriers of the latest versions of each package.

Source§

impl<Querier> MultiQueryDatabase<'_, Querier>

Source

pub fn latest(&self) -> MultiQueryDatabaseLatest<&Self>

Combine the different repositories into a database view of immutable queriers that lookup the latest versions of packages.

Source

pub fn latest_mut(&mut self) -> MultiQueryDatabaseLatest<&mut Self>

Combine the different repositories into a database view of mutable queriers that lookup the latest versions of packages.

Source§

impl<Querier> MultiQueryDatabase<'_, Querier>

Source

pub fn len(&self) -> usize

The number of package names within the database.

Source

pub fn is_empty(&self) -> bool

Whether the database is empty.

Source§

impl<Querier> MultiQueryDatabase<'_, Querier>

Source

pub fn new() -> Self

Create an empty database.

Source

pub fn with_capacity(capacity: usize) -> Self

Create an empty database with at least the specified capacity.

Source§

impl<'query, Querier> MultiQueryDatabase<'query, Querier>

Source

pub fn alternative_providers<'r, 'name>( &'r self, target: DependencyName<'name>, ) -> AlternativeProviders<'r, 'query, 'name, Querier>

Get an iterator over all immutable queriers of packages which list a certain DependencyName in their provides array.

This method is prefixed with “alternative” because a package doesn’t usually list itself in its own provides, and consequently, would usually be excluded from this iterator. Beware that if it does list itself, its own name would be included.

Source

pub fn alternative_providers_mut<'r, 'name>( &'r mut self, target: DependencyName<'name>, ) -> AlternativeProvidersMut<'r, 'query, 'name, Querier>

Get an iterator over all mutable queriers of packages which list a certain DependencyName in their provides array.

This method is prefixed with “alternative” because a package doesn’t usually list itself in its own provides, and consequently, would usually be excluded from this iterator. Beware that if it does list itself, its own name would be included.

Trait Implementations§

Source§

impl<'a, Querier: Clone> Clone for MultiQueryDatabase<'a, Querier>

Source§

fn clone(&self) -> MultiQueryDatabase<'a, Querier>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, Querier: Debug> Debug for MultiQueryDatabase<'a, Querier>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Querier> Default for MultiQueryDatabase<'_, Querier>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a, Querier> IntoIterator for MultiQueryDatabase<'a, Querier>

Source§

type IntoIter = MultiOwnedEntries<'a, Querier>

Which kind of iterator are we turning this into?
Source§

type Item = (Name<'a>, MultiQuerier<'a, Querier>)

The type of the elements being iterated over.
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<'a, Querier> Freeze for MultiQueryDatabase<'a, Querier>

§

impl<'a, Querier> RefUnwindSafe for MultiQueryDatabase<'a, Querier>
where Querier: RefUnwindSafe,

§

impl<'a, Querier> Send for MultiQueryDatabase<'a, Querier>
where Querier: Send,

§

impl<'a, Querier> Sync for MultiQueryDatabase<'a, Querier>
where Querier: Sync,

§

impl<'a, Querier> Unpin for MultiQueryDatabase<'a, Querier>
where Querier: Unpin,

§

impl<'a, Querier> UnwindSafe for MultiQueryDatabase<'a, Querier>
where Querier: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Main> IntoAttached for Main

Source§

fn into_attached<Attachment>( self, attachment: Attachment, ) -> Attached<Self, Attachment>

Attach metadata to an object.
Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Is for T

Source§

type Type = T

Source§

fn into_val(self) -> <T as Is>::Type

Source§

fn into_ref(&self) -> &<T as Is>::Type

Source§

fn into_mut_ref(&mut self) -> &mut <T as Is>::Type

Source§

fn from_val(x: <T as Is>::Type) -> T

Source§

fn from_ref(x: &<T as Is>::Type) -> &T

Source§

fn from_mut_ref(x: &mut <T as Is>::Type) -> &mut T

Source§

impl<X> Pipe for X

Source§

fn pipe<Return, Function>(self, f: Function) -> Return
where Self: Sized, Function: FnOnce(Self) -> Return,

Apply f to self. Read more
Source§

fn pipe_ref<'a, Return, Function>(&'a self, f: Function) -> Return
where Function: FnOnce(&'a Self) -> Return,

Apply f to &self. Read more
Source§

fn pipe_mut<'a, Return, Function>(&'a mut self, f: Function) -> Return
where Function: FnOnce(&'a mut Self) -> Return,

Apply f to &mut self. Read more
Source§

fn pipe_as_ref<'a, Param, Return, Function>(&'a self, f: Function) -> Return
where Self: AsRef<Param>, Param: 'a + ?Sized, Function: FnOnce(&'a Param) -> Return,

Apply f to &self where f takes a single parameter of type Param and Self implements trait AsRef<Param>. Read more
Source§

fn pipe_as_mut<'a, Param, Return, Function>(&'a mut self, f: Function) -> Return
where Self: AsMut<Param>, Param: 'a + ?Sized, Function: FnOnce(&'a mut Param) -> Return,

Apply f to &mut self where f takes a single parameter of type Param and Self implements trait AsMut<Param>. Read more
Source§

fn pipe_deref<'a, Param, Return, Function>(&'a self, f: Function) -> Return
where Self: Deref<Target = Param>, Param: 'a + ?Sized, Function: FnOnce(&'a Param) -> Return,

Apply f to &self where f takes a single parameter of type Param and Self implements trait Deref<Target = Param>. Read more
Source§

fn pipe_deref_mut<'a, Param, Return, Function>( &'a mut self, f: Function, ) -> Return
where Self: DerefMut<Target = Param>, Param: 'a + ?Sized, Function: FnOnce(&'a mut Param) -> Return,

Apply f to &mut self where f takes a single parameter of type Param and Self implements trait DerefMut<Target = Param>. Read more
Source§

fn pipe_borrow<'a, Param, Return, Function>(&'a self, f: Function) -> Return
where Self: Borrow<Param>, Param: 'a + ?Sized, Function: FnOnce(&'a Param) -> Return,

Apply f to &self where f takes a single parameter of type Param and Self implements trait Borrow<Param>. Read more
Source§

fn pipe_borrow_mut<'a, Param, Return, Function>( &'a mut self, f: Function, ) -> Return
where Self: BorrowMut<Param>, Param: 'a + ?Sized, Function: FnOnce(&'a mut Param) -> Return,

Apply f to &mut self where f takes a single parameter of type Param and Self implements trait BorrowMut<Param>. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.