pub enum RelationOrSoname {
BasicSonameV1(SonameV1),
Relation(PackageRelation),
}
Expand description
Provides either a PackageRelation
or a SonameV1::Basic
.
This enum is used for alpm-package-relations of type run-time dependency and provision in
SourceInfo
.
Variants§
BasicSonameV1(SonameV1)
A shared object name (as SonameV1::Basic
).
Relation(PackageRelation)
A package relation (as PackageRelation
).
Implementations§
Source§impl RelationOrSoname
impl RelationOrSoname
Sourcepub fn parser(input: &mut &str) -> ModalResult<Self>
pub fn parser(input: &mut &str) -> ModalResult<Self>
Recognizes a SonameV1::Basic
or a PackageRelation
in a string slice.
First attempts to recognize a SonameV1::Basic
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 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 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_srcinfo::RelationOrSoname;
use alpm_types::{PackageRelation, SonameV1};
let relation: RelationOrSoname = "example=1.0.0".parse()?;
assert_eq!(
relation,
RelationOrSoname::Relation(PackageRelation::new(
"example".parse()?,
Some("=1.0.0".parse()?)
))
);
let soname: RelationOrSoname = "example.so".parse()?;
assert_eq!(
soname,
RelationOrSoname::BasicSonameV1(SonameV1::new("example.so".parse()?, None, None)?)
);
Source§impl PartialEq<PackageRelation> for RelationOrSoname
impl PartialEq<PackageRelation> for RelationOrSoname
Source§impl PartialEq<SonameV1> for RelationOrSoname
impl PartialEq<SonameV1> for RelationOrSoname
Source§impl PartialEq for RelationOrSoname
impl PartialEq for RelationOrSoname
Source§impl Serialize for RelationOrSoname
impl Serialize 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§
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