Skip to main content

EntryName

Struct EntryName 

Source
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: Name

The package name.

See alpm-package-name.

§version: FullVersion

The full package version.

See alpm-package-version.

Implementations§

Source§

impl EntryName

Source

pub fn new(name: Name, version: FullVersion) -> Self

Creates a new EntryName.

Source

pub fn name(&self) -> &Name

Returns a reference to the Name.

Source

pub fn version(&self) -> &FullVersion

Returns a reference to the FullVersion.

Source

pub fn to_path_buf(&self) -> PathBuf

Returns the entry name as PathBuf.

Trait Implementations§

Source§

impl Clone for EntryName

Source§

fn clone(&self) -> EntryName

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EntryName

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for EntryName

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for EntryName

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for EntryName

Source§

impl FromStr for EntryName

Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a EntryName from a string slice.

Delegates to EntryName::parser_until.

§Errors

Returns an error if EntryName::parser_until fails.

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

impl Ord for EntryName

Source§

fn cmp(&self, other: &EntryName) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl ParserUntil for EntryName

Source§

fn parser_until<'a, P>( delimiter: P, ) -> impl Parser<Input<'a>, Self, ErrMode<ParseStack<'a>>>
where P: Parser<Input<'a>, &'a str, ErrMode<ParseStack<'a>>>,

Recognizes an EntryName in a string slice before a delimiter.

§Errors

Returns an error if

  • the Name component can not be recognized,
  • or the FullVersion component 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>>>

Returns a [Parser] that parses an entire input. Read more
Source§

fn parser_until_line_ending<'a>( input: &mut LocatingSlice<&'a str>, ) -> Result<Self, ErrMode<ParseStack<'a>>>

Returns a [Parser] that parses until the end of line or [eof]. Read more
Source§

impl PartialEq for EntryName

Source§

fn eq(&self, other: &EntryName) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for EntryName

Source§

fn partial_cmp(&self, other: &EntryName) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for EntryName

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for EntryName

Source§

impl TryFrom<&Path> for EntryName

Source§

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 FromStr implementation).
Source§

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AnyEq for T
where T: Any + PartialEq,

§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<U> ParserUntilInclusive for U
where U: ParserUntil,

Source§

fn parser_until_inclusive<'a, P>( delimiter: P, ) -> impl Parser<LocatingSlice<&'a str>, U, ErrMode<ParseStack<'a>>>
where P: Parser<LocatingSlice<&'a str>, &'a str, 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>>>

Returns a [Parser] that parses until the end of line and fully consumes it. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.