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
impl SourceInfoContent
Sourcefn preceding_lines_parser(input: &mut &str) -> ModalResult<Ignored>
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.
Sourcepub fn parser(input: &mut &str) -> ModalResult<SourceInfoContent>
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§
Auto Trait Implementations§
impl Freeze for SourceInfoContent
impl RefUnwindSafe for SourceInfoContent
impl !Send for SourceInfoContent
impl !Sync for SourceInfoContent
impl Unpin for SourceInfoContent
impl UnwindSafe for SourceInfoContent
Blanket Implementations§
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
Mutably borrows from an owned value. Read more