pub struct EntryName {
pub name: Name,
pub version: FullVersion,
}Expand description
The name of a directory that stores the metadata of an installed package.
This combines an alpm-package-name and a full alpm-package-version.
Fields§
§name: NameThe package name.
See alpm-package-name.
version: FullVersionThe full package version.
See alpm-package-version.
Implementations§
Source§impl EntryName
impl EntryName
Sourcepub fn new(name: Name, version: FullVersion) -> Self
pub fn new(name: Name, version: FullVersion) -> Self
Creates a new EntryName.
Sourcepub fn version(&self) -> &FullVersion
pub fn version(&self) -> &FullVersion
Returns a reference to the FullVersion.
Sourcepub fn to_path_buf(&self) -> PathBuf
pub fn to_path_buf(&self) -> PathBuf
Returns the entry name as PathBuf.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for EntryName
impl<'de> Deserialize<'de> for EntryName
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>,
impl Eq for EntryName
Source§impl Ord for EntryName
impl Ord for EntryName
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl ParserUntil for EntryName
impl ParserUntil for EntryName
Source§fn parser_until<'a, P>(
delimiter: P,
) -> impl Parser<Input<'a>, Self, ErrMode<ParseStack<'a>>>
fn parser_until<'a, P>( delimiter: P, ) -> impl Parser<Input<'a>, Self, ErrMode<ParseStack<'a>>>
Recognizes an EntryName in a string slice before a delimiter.
§Errors
Returns an error if
- the
Namecomponent can not be recognized, - or the
FullVersioncomponent can not be recognized,
§Examples
use alpm_parsers::prelude::*;
use alpm_types::EntryName;
use winnow::Parser;
let entry_name = "example-package-1:1.0.0-1";
assert_eq!(
entry_name,
EntryName::parser_until_eof
.parse(Input::new(entry_name))?
.to_string()
);Source§fn parser_until_eof<'a>(
input: &mut LocatingSlice<&'a str>,
) -> Result<Self, ErrMode<ParseStack<'a>>>
fn parser_until_eof<'a>( input: &mut LocatingSlice<&'a str>, ) -> Result<Self, ErrMode<ParseStack<'a>>>
Source§fn parser_until_line_ending<'a>(
input: &mut LocatingSlice<&'a str>,
) -> Result<Self, ErrMode<ParseStack<'a>>>
fn parser_until_line_ending<'a>( input: &mut LocatingSlice<&'a str>, ) -> Result<Self, ErrMode<ParseStack<'a>>>
Source§impl PartialOrd for EntryName
impl PartialOrd for EntryName
impl StructuralPartialEq for EntryName
Source§impl TryFrom<&Path> for EntryName
impl TryFrom<&Path> for EntryName
Source§fn try_from(value: &Path) -> Result<Self, Self::Error>
fn try_from(value: &Path) -> Result<Self, Self::Error>
Creates an EntryName from the file name of a Path.
§Note
The last component of the path is used as the entry name. This function relies on metadata and file type checks on the file system.
§Errors
Returns an error if:
- the metadata of the directory cannot be read,
- the path is not a directory,
- the path does not have a file name,
- the file name cannot be converted to a string,
- or the file name cannot be parsed as a valid entry name (see
FromStrimplementation).
Auto Trait Implementations§
impl Freeze for EntryName
impl RefUnwindSafe for EntryName
impl Send for EntryName
impl Sync for EntryName
impl Unpin for EntryName
impl UnsafeUnpin for EntryName
impl UnwindSafe for EntryName
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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<LocatingSlice<&'a str>, U, ErrMode<ParseStack<'a>>>
fn parser_until_inclusive<'a, P>( delimiter: P, ) -> impl Parser<LocatingSlice<&'a str>, U, ErrMode<ParseStack<'a>>>
Returns a [Parser] that parses the whole input and consumes the given delimiter parser.
Delegates to ParserUntil::parser_until and consumes the delimiter.
Source§fn parser_until_line_ending_inclusive<'a>(
input: &mut LocatingSlice<&'a str>,
) -> Result<Self, ErrMode<ParseStack<'a>>>
fn parser_until_line_ending_inclusive<'a>( input: &mut LocatingSlice<&'a str>, ) -> Result<Self, ErrMode<ParseStack<'a>>>
Parser] that parses until the end of line and fully consumes it. Read more