pub enum RelationOrSoname {
Relation(PackageRelation),
SonameV1(SonameV1),
SonameV2(SonameV2),
}Expand description
Provides either a PackageRelation, a SonameV1 or a SonameV2.
This enum is used for alpm-package-relations of type run-time dependency and provision e.g. in PKGINFO, SRCINFO or alpm-db-desc files.
Variants§
Relation(PackageRelation)
A package relation (as PackageRelation).
SonameV1(SonameV1)
A shared object name following alpm-sonamev1.
SonameV2(SonameV2)
A shared object name following alpm-sonamev2.
Implementations§
Source§impl RelationOrSoname
impl RelationOrSoname
Sourcepub fn parser(input: &mut &str) -> ModalResult<Self>
pub fn parser(input: &mut &str) -> ModalResult<Self>
Recognizes a SonameV2, a SonameV1 or a PackageRelation in a string slice.
First attempts to recognize a SonameV2, then a SonameV1 and if that fails, falls
back to recognizing a PackageRelation.
Depending on recognized type, a RelationOrSoname is created accordingly.
Trait Implementations§
Source§impl Clone for RelationOrSoname
impl Clone for RelationOrSoname
Source§fn clone(&self) -> RelationOrSoname
fn clone(&self) -> RelationOrSoname
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RelationOrSoname
impl Debug for RelationOrSoname
Source§impl<'de> Deserialize<'de> for RelationOrSoname
impl<'de> Deserialize<'de> for RelationOrSoname
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 RelationOrSoname
impl Display for RelationOrSoname
Source§impl FromStr for RelationOrSoname
impl FromStr for RelationOrSoname
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Creates a RelationOrSoname from a string slice.
Relies on RelationOrSoname::parser to recognize types in input and create a
RelationOrSoname accordingly.
§Errors
Returns an error if no RelationOrSoname can be created from input.
§Examples
use alpm_types::{PackageRelation, RelationOrSoname, SonameV1, SonameV2};
let relation: RelationOrSoname = "example=1.0.0".parse()?;
assert_eq!(
relation,
RelationOrSoname::Relation(PackageRelation::new(
"example".parse()?,
Some("=1.0.0".parse()?)
))
);
let sonamev2: RelationOrSoname = "lib:example.so.1".parse()?;
assert_eq!(
sonamev2,
RelationOrSoname::SonameV2(SonameV2::new("lib".parse()?, "example.so.1".parse()?))
);
let sonamev1: RelationOrSoname = "example.so".parse()?;
assert_eq!(
sonamev1,
RelationOrSoname::SonameV1(SonameV1::new("example.so".parse()?, None, None)?)
);