Struct Repository

Source
pub struct Repository { /* private fields */ }
Expand description

Arch Linux repository

Implementations§

Source§

impl Repository

Source

pub async fn load(name: &str, url: &str) -> Result<Repository, Box<dyn Error>>

Loads arch repository by it’s name and url

§Example
use archlinux_repo::Repository;

let repo = Repository::load("mingw64", "http://repo.msys2.org/mingw/x86_64").await?;
Source

pub fn get_package_by_name(&self, name: &str) -> Option<&Package>

Get package by full name. Will return None if package cannot be found

§Example
use archlinux_repo::Repository;

let repo = Repository::load("mingw64", "http://repo.msys2.org/mingw/x86_64").await?;
let gtk = repo.get_package_by_name("mingw-w64-x86_64-gtk3")?;
Source

pub fn get_package_by_name_and_version(&self, name: &str) -> Option<&Package>

Get package by full name and version. Will return None if package cannot be found

§Example
use archlinux_repo::Repository;

let repo = Repository::load("mingw64", "http://repo.msys2.org/mingw/x86_64").await?;
let gtk = repo.get_package_by_name_and_version("mingw-w64-x86_64-gtk3-3.24.9-4")?;
Source

pub fn get_package_by_base(&self, name: &str) -> Option<&Package>

Get package by base name. Will return None if package cannot be found

NOTE! Not all packages have names

§Example
use archlinux_repo::Repository;

let repo = Repository::load("mingw64", "http://repo.msys2.org/mingw/x86_64").await?;
let gtk = repo.get_package_by_base("mingw-w64-gtk3")?;
Source

pub fn get_package_files(&self, name: &str) -> Option<&Vec<String>>

Get package files by full name. Will return None if package cannot be found or does not contains file metadata

NOTE! This method will always return None if load_files_meta is false NOTE! For CSV packages base package name will always return None unless it exists in repo

§Example
use archlinux_repo::{Repository, RepositoryBuilder};

let repo = RepositoryBuilder::new("mingw64", "http://repo.msys2.org/mingw/x86_64")
                .files_metadata(true)
                .load()
                .await?;
let gtk_files = repo.get_package_files("mingw-w64-x86_64-gtk3")?;
Source

pub async fn request_package( &self, name: &str, ) -> Result<Response, Box<dyn Error>>

Send HTTP request to download package by full name/base name or name with version. Panics if package not found

§Example
use archlinux_repo::Repository;

let repo = Repository::load("mingw64", "http://repo.msys2.org/mingw/x86_64").await?;
let gtk_package = repo.request_package("mingw-w64-gtk3").await?.bytes().await?;
Source

pub async fn reload(&mut self) -> Result<(), Box<dyn Error>>

Reload repository

Trait Implementations§

Source§

impl Index<&str> for Repository

Source§

type Output = Package

The returned type after indexing.
Source§

fn index(&self, index: &str) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a> IntoIterator for &'a Repository

Source§

type Item = &'a Package

The type of the elements being iterated over.
Source§

type IntoIter = Box<dyn Iterator<Item = <&'a Repository as IntoIterator>::Item> + 'a>

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

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,