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.
Trait Implementations§
Source§impl AlpmParser for RelationOrSoname
impl AlpmParser for RelationOrSoname
Source§fn parser(input: &mut &str) -> ModalResult<Self>
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.
§Errors
Returns an error if input does not begin with a valid
SonameV2, SonameV1 or PackageRelation.
Source§impl Clone for RelationOrSoname
impl Clone for RelationOrSoname
Source§fn clone(&self) -> RelationOrSoname
fn clone(&self) -> RelationOrSoname
1.0.0 (const: unstable) · 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)?)
);Source§impl PartialEq<PackageRelation> for RelationOrSoname
impl PartialEq<PackageRelation> for RelationOrSoname
Source§fn eq(&self, other: &PackageRelation) -> bool
fn eq(&self, other: &PackageRelation) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialEq<SonameV1> for RelationOrSoname
impl PartialEq<SonameV1> for RelationOrSoname
Source§impl PartialEq<SonameV2> for RelationOrSoname
impl PartialEq<SonameV2> for RelationOrSoname
Source§impl PartialEq for RelationOrSoname
impl PartialEq for RelationOrSoname
Source§fn eq(&self, other: &RelationOrSoname) -> bool
fn eq(&self, other: &RelationOrSoname) -> bool
self and other values to be equal, and is used by ==.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 UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<U> ParserUntil for Uwhere
U: AlpmParser,
impl<U> ParserUntil for Uwhere
U: AlpmParser,
Source§fn parser_until<'a, P>(
delimiter: P,
) -> impl Parser<&'a str, U, ErrMode<ContextError>>
fn parser_until<'a, P>( delimiter: P, ) -> impl Parser<&'a str, U, ErrMode<ContextError>>
Returns a [Parser] that parses Self until the given delimiter parser
matches.
§Note
Does not consume the delimiter.
Source§fn parser_until_eof(input: &mut &str) -> Result<Self, ErrMode<ContextError>>
fn parser_until_eof(input: &mut &str) -> Result<Self, ErrMode<ContextError>>
Source§impl<U> ParserUntilInclusive for Uwhere
U: ParserUntil,
impl<U> ParserUntilInclusive for Uwhere
U: ParserUntil,
Source§fn parser_until_inclusive<'a, P>(
delimiter: P,
) -> impl Parser<&'a str, U, ErrMode<ContextError>>
fn parser_until_inclusive<'a, P>( delimiter: P, ) -> impl Parser<&'a str, U, ErrMode<ContextError>>
Returns a [Parser] that parses the whole input and consumes the given delimiter parser.
Delegates to ParserUntil::parser_until and consumes the delimiter.