pub struct PackageInfoV2 {Show 20 fields
pkgname: Name,
pkgbase: Name,
pkgver: Version,
pkgdesc: PackageDescription,
url: Url,
builddate: BuildDate,
packager: Packager,
size: InstalledSize,
arch: Architecture,
license: Vec<License>,
replaces: Vec<PackageRelation>,
group: Vec<Group>,
conflict: Vec<PackageRelation>,
provides: Vec<RelationOrSoname>,
backup: Vec<Backup>,
depend: Vec<RelationOrSoname>,
optdepend: Vec<OptionalDependency>,
makedepend: Vec<PackageRelation>,
checkdepend: Vec<PackageRelation>,
xdata: Vec<ExtraData>,
}
Expand description
PKGINFO version 2
PackageInfoV2
is (exclusively) compatible with data following the v2 specification of the
PKGINFO file.
§Examples
use std::str::FromStr;
use alpm_pkginfo::PackageInfoV2;
let pkginfo_data = r#"pkgname = example
pkgbase = example
xdata = pkgtype=pkg
pkgver = 1:1.0.0-1
pkgdesc = A project that does something
url = https://example.org/
builddate = 1729181726
packager = John Doe <john@example.org>
size = 181849963
arch = any
license = GPL-3.0-or-later
license = LGPL-3.0-or-later
replaces = other-package>0.9.0-3
group = package-group
group = other-package-group
conflict = conflicting-package<1.0.0
conflict = other-conflicting-package<1.0.0
provides = some-component
provides = some-other-component=1:1.0.0-1
provides = libexample.so=1-64
provides = libunversionedexample.so=libunversionedexample.so-64
provides = lib:libexample.so.1
backup = etc/example/config.toml
backup = etc/example/other-config.txt
depend = glibc
depend = gcc-libs
depend = libother.so=0-64
depend = libunversioned.so=libunversioned.so-64
depend = lib:libother.so.0
optdepend = python: for special-python-script.py
optdepend = ruby: for special-ruby-script.rb
makedepend = cmake
makedepend = python-sphinx
checkdepend = extra-test-tool
checkdepend = other-extra-test-tool"#;
let pkginfo = PackageInfoV2::from_str(pkginfo_data)?;
assert_eq!(pkginfo.to_string(), pkginfo_data);
Fields§
§pkgname: Name
§pkgbase: Name
§pkgver: Version
§pkgdesc: PackageDescription
§url: Url
§builddate: BuildDate
§packager: Packager
§size: InstalledSize
§arch: Architecture
§license: Vec<License>
§replaces: Vec<PackageRelation>
§group: Vec<Group>
§conflict: Vec<PackageRelation>
§provides: Vec<RelationOrSoname>
§backup: Vec<Backup>
§depend: Vec<RelationOrSoname>
§optdepend: Vec<OptionalDependency>
§makedepend: Vec<PackageRelation>
§checkdepend: Vec<PackageRelation>
§xdata: Vec<ExtraData>
Implementations§
Source§impl PackageInfoV2
impl PackageInfoV2
Sourcepub fn pkgdesc(&self) -> &PackageDescription
pub fn pkgdesc(&self) -> &PackageDescription
Returns the description of the package
Sourcepub fn size(&self) -> &InstalledSize
pub fn size(&self) -> &InstalledSize
Returns the size of the package
Sourcepub fn arch(&self) -> &Architecture
pub fn arch(&self) -> &Architecture
Returns the architecture of the package
Sourcepub fn replaces(&self) -> &[PackageRelation]
pub fn replaces(&self) -> &[PackageRelation]
Returns the packages this package replaces
Sourcepub fn conflict(&self) -> &[PackageRelation]
pub fn conflict(&self) -> &[PackageRelation]
Returns the packages this package conflicts with
Sourcepub fn provides(&self) -> &[RelationOrSoname]
pub fn provides(&self) -> &[RelationOrSoname]
Returns the packages this package provides
Sourcepub fn depend(&self) -> &[RelationOrSoname]
pub fn depend(&self) -> &[RelationOrSoname]
Returns the packages this package depends on
Sourcepub fn optdepend(&self) -> &[OptionalDependency]
pub fn optdepend(&self) -> &[OptionalDependency]
Returns the optional dependencies of the package
Sourcepub fn makedepend(&self) -> &[PackageRelation]
pub fn makedepend(&self) -> &[PackageRelation]
Returns the packages this package is built with
Sourcepub fn checkdepend(&self) -> &[PackageRelation]
pub fn checkdepend(&self) -> &[PackageRelation]
Returns the packages this package is checked with
Source§impl PackageInfoV2
impl PackageInfoV2
Sourcepub fn new(
pkgname: Name,
pkgbase: Name,
pkgver: Version,
pkgdesc: PackageDescription,
url: Url,
builddate: BuildDate,
packager: Packager,
size: InstalledSize,
arch: Architecture,
license: Vec<License>,
replaces: Vec<PackageRelation>,
group: Vec<Group>,
conflict: Vec<PackageRelation>,
provides: Vec<RelationOrSoname>,
backup: Vec<Backup>,
depend: Vec<RelationOrSoname>,
optdepend: Vec<OptionalDependency>,
makedepend: Vec<PackageRelation>,
checkdepend: Vec<PackageRelation>,
xdata: Vec<ExtraData>,
) -> Result<Self, Error>
pub fn new( pkgname: Name, pkgbase: Name, pkgver: Version, pkgdesc: PackageDescription, url: Url, builddate: BuildDate, packager: Packager, size: InstalledSize, arch: Architecture, license: Vec<License>, replaces: Vec<PackageRelation>, group: Vec<Group>, conflict: Vec<PackageRelation>, provides: Vec<RelationOrSoname>, backup: Vec<Backup>, depend: Vec<RelationOrSoname>, optdepend: Vec<OptionalDependency>, makedepend: Vec<PackageRelation>, checkdepend: Vec<PackageRelation>, xdata: Vec<ExtraData>, ) -> Result<Self, Error>
Create a new PackageInfoV2 from all required components
Sourcepub fn pkg_type(&self) -> PackageType
pub fn pkg_type(&self) -> PackageType
Returns the package type.
§Panics
This function panics if the xdata
field does not contain a pkgtype
key.
Trait Implementations§
Source§impl Clone for PackageInfoV2
impl Clone for PackageInfoV2
Source§fn clone(&self) -> PackageInfoV2
fn clone(&self) -> PackageInfoV2
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 PackageInfoV2
impl Debug for PackageInfoV2
Source§impl<'de> Deserialize<'de> for PackageInfoV2
impl<'de> Deserialize<'de> for PackageInfoV2
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for PackageInfoV2
impl Display for PackageInfoV2
Auto Trait Implementations§
impl Freeze for PackageInfoV2
impl RefUnwindSafe for PackageInfoV2
impl Send for PackageInfoV2
impl Sync for PackageInfoV2
impl Unpin for PackageInfoV2
impl UnwindSafe for PackageInfoV2
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