pub enum SonameV1 {
Basic(SharedObjectName),
Unversioned {
name: SharedObjectName,
soname: SharedObjectName,
architecture: ElfArchitectureFormat,
},
Explicit {
name: SharedObjectName,
version: PackageVersion,
architecture: ElfArchitectureFormat,
},
}Expand description
Representation of soname data of a shared object based on the alpm-sonamev1 specification.
Soname data may be used as alpm-package-relation of type provision and run-time dependency. This type distinguishes between three forms: basic, unversioned and explicit.
SonameV1::Basicis used when only thenameof a shared object file is used. This form can be used in files that may contain static data about package sources (e.g. PKGBUILD or SRCINFO files).SonameV1::Unversionedis used when thenameof a shared object file, its soname (which does not expose a specific version) and itsarchitecture(derived from the ELF class of the file) are used. This form can be used in files that may contain dynamic data derived from a specific package build environment (i.e. PKGINFO). It is discouraged to use this form in files that contain static data about package sources (e.g. PKGBUILD or SRCINFO files).SonameV1::Explicitis used when thenameof a shared object file, theversionfrom its soname and itsarchitecture(derived from the ELF class of the file) are used. This form can be used in files that may contain dynamic data derived from a specific package build environment (i.e. PKGINFO). It is discouraged to use this form in files that contain static data about package sources (e.g. PKGBUILD or SRCINFO files).
§Warning
This type is deprecated and SonameV2 should be preferred instead!
Due to the loose nature of the alpm-sonamev1 specification, the basic form overlaps with the
specification of Name and the explicit form overlaps with that of PackageRelation.
§Examples
use alpm_types::{ElfArchitectureFormat, SonameV1};
let basic_soname = SonameV1::Basic("example.so".parse()?);
let unversioned_soname = SonameV1::Unversioned {
name: "example.so".parse()?,
soname: "example.so".parse()?,
architecture: ElfArchitectureFormat::Bit64,
};
let explicit_soname = SonameV1::Explicit {
name: "example.so".parse()?,
version: "1.0.0".parse()?,
architecture: ElfArchitectureFormat::Bit64,
};Variants§
Basic(SharedObjectName)
Basic representation of a shared object file.
Tracks the name of a shared object file.
This form is used when referring to shared object files without their soname data.
§Examples
use std::str::FromStr;
use alpm_types::SonameV1;
let soname = SonameV1::from_str("example.so")?;
assert_eq!(soname, SonameV1::Basic("example.so".parse()?));Unversioned
Unversioned representation of an ELF file’s soname data.
Tracks the name of a shared object file, its soname instead of a version and its
architecture. This form is used if the soname data of a shared object does not
expose a version.
§Examples
use std::str::FromStr;
use alpm_types::{ElfArchitectureFormat, SonameV1};
let soname = SonameV1::from_str("example.so=example.so-64")?;
assert_eq!(
soname,
SonameV1::Unversioned {
name: "example.so".parse()?,
soname: "example.so".parse()?,
architecture: ElfArchitectureFormat::Bit64,
}
);Fields
name: SharedObjectNameThe least specific name of the shared object file.
soname: SharedObjectNameThe value of the shared object’s SONAME field in its dynamic section.
architecture: ElfArchitectureFormatThe ELF architecture format of the shared object file.
Explicit
Explicit representation of an ELF file’s soname data.
Tracks the name of a shared object file, the version of its soname and its
architecture. This form is used if the soname data of a shared object exposes a
specific version.
§Examples
use std::str::FromStr;
use alpm_types::{ElfArchitectureFormat, SonameV1};
let soname = SonameV1::from_str("example.so=1.0.0-64")?;
assert_eq!(
soname,
SonameV1::Explicit {
name: "example.so".parse()?,
version: "1.0.0".parse()?,
architecture: ElfArchitectureFormat::Bit64,
}
);Fields
name: SharedObjectNameThe least specific name of the shared object file.
version: PackageVersionThe version of the shared object file (as exposed in its soname data).
architecture: ElfArchitectureFormatThe ELF architecture format of the shared object file.
Implementations§
Source§impl SonameV1
impl SonameV1
Sourcepub fn new(
name: SharedObjectName,
version_or_soname: Option<VersionOrSoname>,
architecture: Option<ElfArchitectureFormat>,
) -> Result<Self, Error>
pub fn new( name: SharedObjectName, version_or_soname: Option<VersionOrSoname>, architecture: Option<ElfArchitectureFormat>, ) -> Result<Self, Error>
Creates a new SonameV1.
Depending on input, this function returns different variants of SonameV1:
SonameV1::Basic, if bothversion_or_sonameandarchitectureareNoneSonameV1::Unversioned, ifversion_or_sonameisVersionOrSoname::SonameandarchitectureisSomeSonameV1::Explicit, ifversion_or_sonameisVersionOrSoname::VersionandarchitectureisSome
§Examples
use alpm_types::{ElfArchitectureFormat, SonameV1};
let basic_soname = SonameV1::new("example.so".parse()?, None, None)?;
assert_eq!(basic_soname, SonameV1::Basic("example.so".parse()?));
let unversioned_soname = SonameV1::new(
"example.so".parse()?,
Some("example.so".parse()?),
Some(ElfArchitectureFormat::Bit64),
)?;
assert_eq!(
unversioned_soname,
SonameV1::Unversioned {
name: "example.so".parse()?,
soname: "example.so".parse()?,
architecture: "64".parse()?
}
);
let explicit_soname = SonameV1::new(
"example.so".parse()?,
Some("1.0.0".parse()?),
Some(ElfArchitectureFormat::Bit64),
)?;
assert_eq!(
explicit_soname,
SonameV1::Explicit {
name: "example.so".parse()?,
version: "1.0.0".parse()?,
architecture: "64".parse()?
}
);Returns a reference to the SharedObjectName of the SonameV1.
§Examples
use alpm_types::{ElfArchitectureFormat, SharedObjectName, SonameV1};
let shared_object_name: SharedObjectName = "example.so".parse()?;
let basic = SonameV1::new("example.so".parse()?, None, None)?;
assert_eq!(&shared_object_name, basic.shared_object_name());
let unversioned = SonameV1::new(
"example.so".parse()?,
Some("example.so".parse()?),
Some(ElfArchitectureFormat::Bit64),
)?;
assert_eq!(&shared_object_name, unversioned.shared_object_name());
let explicit = SonameV1::new(
"example.so".parse()?,
Some("1.0.0".parse()?),
Some(ElfArchitectureFormat::Bit64),
)?;
assert_eq!(&shared_object_name, explicit.shared_object_name());Trait Implementations§
Source§impl AlpmParser for SonameV1
impl AlpmParser for SonameV1
Source§impl<'de> Deserialize<'de> for SonameV1
impl<'de> Deserialize<'de> for SonameV1
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 SonameV1
impl FromStr for SonameV1
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Creates a SonameV1 from a string slice.
The string slice must be in the format name[=version-architecture].
Delegates to SonameV1::parser.
§Errors
Returns an error if SonameV1::parser fails.
§Examples
use std::str::FromStr;
use alpm_types::{ElfArchitectureFormat, SonameV1};
assert_eq!(
SonameV1::from_str("example.so=1.0.0-64")?,
SonameV1::Explicit {
name: "example.so".parse()?,
version: "1.0.0".parse()?,
architecture: ElfArchitectureFormat::Bit64,
},
);
assert_eq!(
SonameV1::from_str("example.so=example.so-64")?,
SonameV1::Unversioned {
name: "example.so".parse()?,
soname: "example.so".parse()?,
architecture: ElfArchitectureFormat::Bit64,
},
);
assert_eq!(
SonameV1::from_str("example.so")?,
SonameV1::Basic("example.so".parse()?),
);Source§impl PartialEq<SonameV1> for RelationOrSoname
impl PartialEq<SonameV1> for RelationOrSoname
impl Eq for SonameV1
impl StructuralPartialEq for SonameV1
Auto Trait Implementations§
impl Freeze for SonameV1
impl RefUnwindSafe for SonameV1
impl Send for SonameV1
impl Sync for SonameV1
impl Unpin for SonameV1
impl UnsafeUnpin for SonameV1
impl UnwindSafe for SonameV1
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.