pub enum RelationOrSoname {
Relation(PackageRelation),
SonameV1(SonameV1),
SonameV2(SonameV2),
}Expand description
Provides either a PackageRelation or a SonameV1.
This enum is used for alpm-package-relations of type run-time dependency and provision in
PackageInfoV1 or PackageInfoV2.
Variants§
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
Returns a duplicate 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 RelationOrSoname
impl Debug for RelationOrSoname
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_pkginfo::RelationOrSoname;
use alpm_types::{PackageRelation, 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)?)
);Source§impl PartialEq for RelationOrSoname
impl PartialEq for RelationOrSoname
impl Eq for RelationOrSoname
impl StructuralPartialEq for RelationOrSoname
Auto Trait Implementations§
impl Freeze for RelationOrSoname
impl RefUnwindSafe for RelationOrSoname
impl Send for RelationOrSoname
impl Sync for RelationOrSoname
impl Unpin for RelationOrSoname
impl UnwindSafe for RelationOrSoname
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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