pub struct SonameV2 {
pub prefix: SharedLibraryPrefix,
pub soname: Soname,
}Expand description
Representation of soname data of a shared object based on the alpm-sonamev2 specification.
Soname data may be used as alpm-package-relation of type provision or run-time dependency
in PackageInfoV1 and PackageInfoV2. The data consists of the arbitrarily
defined prefix, which denotes the use name of a specific library directory, and the soname,
which refers to the value of either the SONAME or a NEEDED field in the dynamic section of
an ELF file.
§Examples
This example assumpes that lib is used as the prefix for the library directory /usr/lib
and the following files are contained in it:
/usr/lib/libexample.so -> libexample.so.1
/usr/lib/libexample.so.1 -> libexample.so.1.0.0
/usr/lib/libexample.so.1.0.0The above file /usr/lib/libexample.so.1.0.0 represents an ELF file, that exposes
libexample.so.1 as value of the SONAME field in its dynamic section. This data can be
represented as follows, using SonameV2:
use alpm_types::{Soname, SonameV2};
let soname_data = SonameV2 {
prefix: "lib".parse()?,
soname: Soname {
name: "libexample.so".parse()?,
version: Some("1".parse()?),
},
};
assert_eq!(soname_data.to_string(), "lib:libexample.so.1");Fields§
§prefix: SharedLibraryPrefixThe directory prefix of the shared object file.
soname: SonameThe soname of a shared object file.
Implementations§
Trait Implementations§
Source§impl AlpmParser for SonameV2
impl AlpmParser for SonameV2
Source§fn parser(input: &mut &str) -> ModalResult<Self>
fn parser(input: &mut &str) -> ModalResult<Self>
Recognizes a SonameV2 in a string slice.
The passed data must be in the format <prefix>:<soname>. (e.g. lib:libexample.so.1)
See Soname::parser for details on the format of <soname>.
§Errors
Returns an error if input does not begin with a valid SonameV2.
Source§impl<'de> Deserialize<'de> for SonameV2
impl<'de> Deserialize<'de> for SonameV2
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 FromStr for SonameV2
impl FromStr for SonameV2
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Creates a SonameV2 from a string slice.
The string slice must be in the format <prefix>:<soname>.
Delegates to SonameV2::parser.
§Errors
Returns an error if SonameV2::parser fails.
§Examples
use std::str::FromStr;
use alpm_types::{Soname, SonameV2};
assert_eq!(
SonameV2::from_str("lib:libexample.so.1")?,
SonameV2::new(
"lib".parse()?,
Soname::new("libexample.so".parse()?, Some("1".parse()?))
),
);Source§impl PartialEq<SonameV2> for RelationOrSoname
impl PartialEq<SonameV2> for RelationOrSoname
impl Eq for SonameV2
impl StructuralPartialEq for SonameV2
Auto Trait Implementations§
impl Freeze for SonameV2
impl RefUnwindSafe for SonameV2
impl Send for SonameV2
impl Sync for SonameV2
impl Unpin for SonameV2
impl UnsafeUnpin for SonameV2
impl UnwindSafe for SonameV2
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.