[][src]Struct srcinfo::Srcinfo

pub struct Srcinfo {
    pub base: PackageBase,
    pub package: Package,
    pub packages: Vec<Package>,
}

A complete representation of a .SRCINFO file.

Fields

base: PackageBase

Fields belonging to the pkgbase

package: Package

Fields belonging to the pkgbase, may be overridden inside of each package

packages: Vec<Package>

The packages this .SRCINFO contains

Methods

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");

Trait Implementations

impl Eq for Srcinfo
[src]

impl PartialOrd<Srcinfo> for Srcinfo
[src]

impl Default for Srcinfo
[src]

impl PartialEq<Srcinfo> for Srcinfo
[src]

impl Clone for Srcinfo
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Ord for Srcinfo
[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl Debug for Srcinfo
[src]

impl Hash for Srcinfo
[src]

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

Feeds a slice of this type into the given [Hasher]. Read more

impl FromStr for Srcinfo
[src]

type Err = Error

The associated error which can be returned from parsing.

Auto Trait Implementations

impl Send for Srcinfo

impl Sync for Srcinfo

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]