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§
Source§impl SonameV2
impl SonameV2
Sourcepub fn new(prefix: SharedLibraryPrefix, soname: Soname) -> Self
pub fn new(prefix: SharedLibraryPrefix, soname: Soname) -> Self
Sourcepub fn parser(input: &mut &str) -> ModalResult<Self>
pub 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 no SonameV2 can be created from input.
Trait Implementations§
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>
Parses a SonameV2 from a string slice.
The string slice must be in the format <prefix>:<soname>.
§Errors
Returns an error if a SonameV2 can not be parsed from input.
§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()?))
),
);