alpm_srcinfo::parser

Struct SourceInfoContent

Source
pub struct SourceInfoContent {
    pub preceding_lines: Vec<Ignored>,
    pub package_base: RawPackageBase,
    pub packages: Vec<RawPackage>,
}
Expand description

A representation of all high-level components of parsed SRCINFO data.

Fields§

§preceding_lines: Vec<Ignored>

Empty or comment lines that occur outside of pkgbase or pkgname sections.

§package_base: RawPackageBase§packages: Vec<RawPackage>

Implementations§

Source§

impl SourceInfoContent

Source

fn preceding_lines_parser(input: &mut &str) -> ModalResult<Ignored>

Parses the start of the file in case it contains one or more empty lines or comment lines.

This consumes the first few lines until the pkgbase section is hit. Further comments and newlines are handled in the scope of the respective pkgbase/pkgname sections.

Source

pub fn parser(input: &mut &str) -> ModalResult<SourceInfoContent>

Recognizes a complete SRCINFO file from a string slice.

use alpm_srcinfo::parser::SourceInfoContent;
use winnow::Parser;

let source_info_data = r#"
pkgbase = example
    pkgver = 1.0.0
    epoch = 1
    pkgrel = 1
    pkgdesc = A project that does something
    url = https://example.org/
    arch = x86_64
    depends = glibc
    optdepends = python: for special-python-script.py
    makedepends = cmake
    checkdepends = extra-test-tool

pkgname = example
    depends = glibc
    depends = gcc-libs
"#;

// Parse the given srcinfo content.
let parsed = SourceInfoContent::parser
    .parse(source_info_data)
    .map_err(|err| alpm_srcinfo::Error::ParseError(format!("{err}")))?;

Trait Implementations§

Source§

impl Debug for SourceInfoContent

Source§

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

Formats the value using the given formatter. Read more

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
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> 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<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T