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
impl SourceEntry
pub fn url(&self) -> &str
sourcepub fn filename(&self) -> String
pub fn filename(&self) -> String
The base filename to be used when storing files for this entries.
sourcepub fn dist_path(&self) -> String
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
pub fn dist_path_get(&self, path: &str) -> String
sourcepub fn dist_components(&self) -> impl Iterator<Item = String> + '_
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());
}
}
}
}
}
}
sourcepub fn pool_path(&self) -> String
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
impl Clone for SourceEntry
source§fn clone(&self) -> SourceEntry
fn clone(&self) -> SourceEntry
Returns a copy 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 SourceEntry
impl Debug for SourceEntry
source§impl Display for SourceEntry
impl Display for SourceEntry
source§impl FromStr for SourceEntry
impl FromStr for SourceEntry
source§impl Hash for SourceEntry
impl Hash for SourceEntry
source§impl PartialEq for SourceEntry
impl PartialEq for SourceEntry
source§fn eq(&self, other: &SourceEntry) -> bool
fn eq(&self, other: &SourceEntry) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for SourceEntry
impl StructuralPartialEq for SourceEntry
Auto Trait Implementations§
impl Freeze for SourceEntry
impl RefUnwindSafe for SourceEntry
impl Send for SourceEntry
impl Sync for SourceEntry
impl Unpin for SourceEntry
impl UnwindSafe for SourceEntry
Blanket Implementations§
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