[−][src]Struct srcinfo::Srcinfo
A complete representation of a .SRCINFO file.
Fields
base: PackageBase
Fields belonging to the pkgbase
pkg: Package
Fields belonging to the pkgbase, may be overridden inside of each package
pkgs: Vec<Package>
The packages this .SRCINFO contains
Implementations
impl Srcinfo
[src]
pub fn parse_buf<T: BufRead>(b: T) -> Result<Srcinfo, Error>
[src]
Parse a BufRead. If you are parsing a string directly from_str() should be used instead.
// from_str() would be better here. // parse_buf() is only used for the sake of example. use srcinfo::Srcinfo; let buf = " pkgbase = example pkgver = 1.5.0 pkgrel = 5 pkgname = example".as_bytes(); Srcinfo::parse_buf(buf)?;
pub fn parse_file<P: AsRef<Path>>(s: P) -> Result<Srcinfo, Error>
[src]
Parse the file at a given path.
use srcinfo::Srcinfo; let file = ".SRCINFO"; let srcinfo = Srcinfo::parse_file(file)?;
pub fn version(&self) -> String
[src]
Builds a complete version string in the format: "epoch-pkgver-pkgrel".
If the epoch is none then the epoch and connecting hyphen will be omitted.
use srcinfo::Srcinfo; let srcinfo: Srcinfo = " pkgbase = example pkgver = 1.5.0 pkgrel = 5 pkgname = example".parse()?; assert_eq!(srcinfo.version(), "1.5.0-5");
pub fn names(&self) -> impl Iterator<Item = &str>
[src]
Returns an Iterator over all the pkgnames the Package contains.
use srcinfo::Srcinfo; let srcinfo: Srcinfo = " pkgbase = example pkgver = 1.5.0 pkgrel = 5 pkgdesc = 1 pkgname = example pkgname = foo pkgdesc = 2 pkgname = bar pkgdesc = 3".parse()?; let mut names = srcinfo.names().collect::<Vec<_>>(); assert_eq!(names, vec!["example", "foo", "bar"]);
pub fn pkg<S: AsRef<str>>(&self, name: S) -> Option<&Package>
[src]
Searches for a package with a given pkgname
use srcinfo::Srcinfo; let srcinfo: Srcinfo = " pkgbase = example pkgver = 1.5.0 pkgrel = 5 pkgdesc = 1 pkgname = example pkgname = foo pkgdesc = 2 pkgname = bar pkgdesc = 3".parse()?; let pkg = srcinfo.pkg("foo").unwrap(); assert_eq!(pkg.pkgname, "foo");
Trait Implementations
impl Clone for Srcinfo
[src]
impl Debug for Srcinfo
[src]
impl Default for Srcinfo
[src]
impl Eq for Srcinfo
[src]
impl FromStr for Srcinfo
[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl Hash for Srcinfo
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Srcinfo
[src]
fn cmp(&self, other: &Srcinfo) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Srcinfo> for Srcinfo
[src]
impl PartialOrd<Srcinfo> for Srcinfo
[src]
fn partial_cmp(&self, other: &Srcinfo) -> Option<Ordering>
[src]
fn lt(&self, other: &Srcinfo) -> bool
[src]
fn le(&self, other: &Srcinfo) -> bool
[src]
fn gt(&self, other: &Srcinfo) -> bool
[src]
fn ge(&self, other: &Srcinfo) -> bool
[src]
impl StructuralEq for Srcinfo
[src]
impl StructuralPartialEq for Srcinfo
[src]
Auto Trait Implementations
impl RefUnwindSafe for Srcinfo
impl Send for Srcinfo
impl Sync for Srcinfo
impl Unpin for Srcinfo
impl UnwindSafe for Srcinfo
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,