Struct oma_apt_sources_lists::SourceEntry

source ·
pub struct SourceEntry {
    pub enabled: bool,
    pub source: bool,
    pub options: Option<String>,
    pub url: String,
    pub suite: String,
    pub components: Vec<String>,
    pub is_deb822: bool,
}
Expand description

An apt source entry that is active on the system.

Fields§

§enabled: bool

Whether the entry is enabled or not.

§source: bool

Whether this is a binary or source repo.

§options: Option<String>

Some repos may have special options defined.

§url: String

The URL of the repo.

§suite: String

The suite of the repo would be as bionic or cosmic.

§components: Vec<String>

Components that have been enabled for this repo.

§is_deb822: bool

Implementations§

source§

impl SourceEntry

source

pub fn url(&self) -> &str

source

pub fn filename(&self) -> String

The base filename to be used when storing files for this entries.

source

pub fn dist_path(&self) -> String

Returns the root URL for this entry’s dist path.

For an entry such as:

deb http://us.archive.ubuntu.com/ubuntu/ cosmic main

The path that will be returned will be:

http://us.archive.ubuntu.com/ubuntu/dists/cosmic
source

pub fn dist_path_get(&self, path: &str) -> String

source

pub fn dist_components(&self) -> impl Iterator<Item = String> + '_

Iterator that returns each of the dist components that are to be fetched.

Examples found in repository?
examples/list.rs (line 12)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
pub fn main() {
    let list = SourcesLists::scan().unwrap();
    for file in list.iter() {
        println!("{}:", file.path.display());
        match &file.entries {
            SourceListType::Deb822(entries) => {
                for entry in &entries.entries {
                    println!("  {}", entry);
                    println!("    Dist paths:");
                    for dist in entry.dist_components() {
                        println!("      {}", dist);
                    }
                    println!("    Pool path: {}", entry.pool_path());
                }
            }
            SourceListType::SourceLine(lines) => {
                for entry in lines {
                    println!("  {}", entry);
                    if let SourceLine::Entry(ref entry) = entry {
                        println!("    Dist paths:");
                        for dist in entry.dist_components() {
                            println!("      {}", dist);
                        }
                        println!("    Pool path: {}", entry.pool_path());
                    }
                }
            }
        }
    }
}
source

pub fn pool_path(&self) -> String

Returns the root URL for this entry’s pool path.

For an entry such as:

deb http://us.archive.ubuntu.com/ubuntu/ cosmic main

The path that will be returned will be:

http://us.archive.ubuntu.com/ubuntu/pool/cosmic
Examples found in repository?
examples/list.rs (line 15)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
pub fn main() {
    let list = SourcesLists::scan().unwrap();
    for file in list.iter() {
        println!("{}:", file.path.display());
        match &file.entries {
            SourceListType::Deb822(entries) => {
                for entry in &entries.entries {
                    println!("  {}", entry);
                    println!("    Dist paths:");
                    for dist in entry.dist_components() {
                        println!("      {}", dist);
                    }
                    println!("    Pool path: {}", entry.pool_path());
                }
            }
            SourceListType::SourceLine(lines) => {
                for entry in lines {
                    println!("  {}", entry);
                    if let SourceLine::Entry(ref entry) = entry {
                        println!("    Dist paths:");
                        for dist in entry.dist_components() {
                            println!("      {}", dist);
                        }
                        println!("    Pool path: {}", entry.pool_path());
                    }
                }
            }
        }
    }
}

Trait Implementations§

source§

impl Clone for SourceEntry

source§

fn clone(&self) -> SourceEntry

Returns a copy 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 Debug for SourceEntry

source§

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

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

impl Display for SourceEntry

source§

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

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

impl FromStr for SourceEntry

§

type Err = SourceError

The associated error which can be returned from parsing.
source§

fn from_str(line: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl Hash for SourceEntry

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for SourceEntry

source§

fn eq(&self, other: &SourceEntry) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for SourceEntry

source§

impl StructuralPartialEq for SourceEntry

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, 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> ToOwned for T
where T: Clone,

§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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.