pub struct DbDescFileV1 {Show 19 fields
pub name: Name,
pub version: Version,
pub base: PackageBaseName,
pub description: PackageDescription,
pub url: Option<Url>,
pub arch: Architecture,
pub builddate: BuildDate,
pub installdate: BuildDate,
pub packager: Packager,
pub size: InstalledSize,
pub groups: Vec<Group>,
pub reason: PackageInstallReason,
pub license: Vec<License>,
pub validation: PackageValidation,
pub replaces: Vec<PackageRelation>,
pub depends: Vec<PackageRelation>,
pub optdepends: Vec<OptionalDependency>,
pub conflicts: Vec<PackageRelation>,
pub provides: Vec<PackageRelation>,
}Expand description
DB DESC version 1
DbDescFileV1 represents the alpm-db-descv1 specification which is the
canonical format of a single package entry within an ALPM database.
It includes information such as the package’s name, version, architecture, and dependency relationships.
§Examples
use std::str::FromStr;
use alpm_db::desc::DbDescFileV1;
let desc_data = r#"%NAME%
foo
%VERSION%
1.0.0-1
%BASE%
foo
%DESC%
An example package
%URL%
https://example.org/
%ARCH%
x86_64
%BUILDDATE%
1733737242
%INSTALLDATE%
1733737243
%PACKAGER%
Foobar McFooface <foobar@mcfooface.org>
%SIZE%
123
%GROUPS%
utils
cli
%REASON%
1
%LICENSE%
MIT
Apache-2.0
%VALIDATION%
pgp
%REPLACES%
pkg-old
%DEPENDS%
glibc
%OPTDEPENDS%
optpkg
%CONFLICTS%
foo-old
%PROVIDES%
foo-virtual
"#;
// Parse a DB DESC file in version 1 format.
let db_desc = DbDescFileV1::from_str(desc_data)?;
// Convert back to its canonical string representation.
assert_eq!(db_desc.to_string(), desc_data);Fields§
§name: NameThe name of the package.
version: VersionThe version of the package.
base: PackageBaseNameThe base name of the package (used in split packages).
description: PackageDescriptionThe description of the package.
url: Option<Url>The URL for the project of the package.
arch: ArchitectureThe architecture of the package.
builddate: BuildDateThe date at which the build of the package started.
installdate: BuildDateThe date at which the package has been installed on the system.
packager: PackagerThe User ID of the entity, that built the package.
size: InstalledSizeThe optional size of the (uncompressed and unpacked) package contents in bytes.
groups: Vec<Group>Groups the package belongs to.
reason: PackageInstallReasonThe reason for installing the package.
license: Vec<License>Licenses that apply to the package.
validation: PackageValidationValidation method used for the package.
replaces: Vec<PackageRelation>Packages this one replaces.
depends: Vec<PackageRelation>Required runtime dependencies.
optdepends: Vec<OptionalDependency>Optional dependencies that enhance the package.
conflicts: Vec<PackageRelation>Conflicting packages that cannot be installed together.
provides: Vec<PackageRelation>Virtual packages or capabilities provided by this one.
Trait Implementations§
Source§impl Clone for DbDescFileV1
impl Clone for DbDescFileV1
Source§fn clone(&self) -> DbDescFileV1
fn clone(&self) -> DbDescFileV1
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DbDescFileV1
impl Debug for DbDescFileV1
Source§impl<'de> Deserialize<'de> for DbDescFileV1
impl<'de> Deserialize<'de> for DbDescFileV1
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>,
Source§impl Display for DbDescFileV1
impl Display for DbDescFileV1
Source§impl From<DbDescFileV2> for DbDescFileV1
impl From<DbDescFileV2> for DbDescFileV1
Source§fn from(v2: DbDescFileV2) -> Self
fn from(v2: DbDescFileV2) -> Self
Converts a DbDescFileV2 into a DbDescFileV1.
§Note
This drops the xdata field of the DbDescFileV2, which provides additional information
about a package.
Source§impl FromStr for DbDescFileV1
impl FromStr for DbDescFileV1
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Creates a DbDescFileV1 from a string slice.
Parses the input according to the alpm-db-descv1 specification and constructs a
structured DbDescFileV1 representation.
§Examples
use std::str::FromStr;
use alpm_db::desc::DbDescFileV1;
let desc_data = r#"%NAME%
foo
%VERSION%
1.0.0-1
%BASE%
foo
%DESC%
An example package
%URL%
https://example.org
%ARCH%
x86_64
%BUILDDATE%
1733737242
%INSTALLDATE%
1733737243
%PACKAGER%
Foobar McFooface <foobar@mcfooface.org>
%SIZE%
123
%VALIDATION%
pgp
"#;
let db_desc = DbDescFileV1::from_str(desc_data)?;
assert_eq!(db_desc.name.to_string(), "foo");§Errors
Returns an error if:
- the input cannot be parsed into valid sections,
- or required fields are missing or malformed.