Struct BridgeOutput

Source
pub struct BridgeOutput {
    pub package_base: HashMap<Keyword, Value>,
    pub packages: HashMap<RawPackageName, HashMap<Keyword, ClearableValue>>,
    pub functions: Vec<RawPackageName>,
}
Expand description

Represents the raw parsed, but not yet typed output of the alpm-pkgbuild-bridge script.

Fields§

§package_base: HashMap<Keyword, Value>

The map of all assigned keywords in the pkgbase section of the bridge output.

§packages: HashMap<RawPackageName, HashMap<Keyword, ClearableValue>>

The map of all assigned keywords in the package section of the bridge output. The keywords are grouped by package name.

§functions: Vec<RawPackageName>

The list of all package function names that are declared in the bridge output.

Implementations§

Source§

impl BridgeOutput

Source

pub fn from_file(pkgbuild_path: &Path) -> Result<Self, Error>

Creates a BridgeOutput from a PKGBUILD at a given path, by calling the alpm-pkgbuild-bridge script.

Source

pub fn from_script_output(input: &str) -> Result<Self, Error>

Creates a BridgeOutput from some alpm-pkgbuild-bridge script output.

This function is mostly exposed for testing, consider using Self::from_file.

Source

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

Parse some given [alpm-pkgbuild-bridge] script output into Self.

Use Self::from_script_output for convenient error handling. Recognizes a BridgeOutput in the output of the alpm-pkgbuild-bridge script.

§Errors

Returns an error if no BridgeOutput can be found in input.

Source

fn package_base(input: &mut &str) -> ModalResult<HashMap<Keyword, Value>>

Recognizes a map of Keyword-Value pairs in a string slice.

Backtracks as soon as the next section is hit.

§Errors

Returns an error if there is not at least one Keyword-Value pair in input.

Source

fn package_base_line(input: &mut &str) -> ModalResult<(Keyword, Value)>

Recognizes a Keyword-Value pair in a string slice.

Backtracks as soon any other line prefix than VAR GLOBAL is encountered.

§Errors

Returns an error if no Keyword-Value pair can be found in input.

Source

fn packages( input: &mut &str, ) -> ModalResult<HashMap<RawPackageName, HashMap<Keyword, ClearableValue>>>

Recognizes an entire section of package variable declarations.

Delegates to BridgeOutput::package_line to recognize singular tuples of RawPackageName, Keyword and ClearableValue per line and combines the data in a HashMap.

Backtracks as soon as the next section is hit.

§Errors

Returns an error if BridgeOutput::package_line does not find at least one line in input.

Source

fn package_line( input: &mut &str, ) -> ModalResult<(RawPackageName, Keyword, ClearableValue)>

Recognizes a tuple of RawPackageName, Keyword and ClearableValue in a string slice.

The tuple represents a single package variable line. Backtracks as soon any other line prefix than FUNCTION is encountered.

§Errors

Returns an error if one of the components (RawPackageName, Keyword and ClearableValue) is not found in input.

Source

fn functions(input: &mut &str) -> ModalResult<Vec<RawPackageName>>

Recognizes a list of RawPackageNames in a string slice.

Delegates to BridgeOutput::function_line to recognize each singular RawPackageName. This parser may return an empty array, which is the case for alpm-meta-packages without a package function.

§Errors

Returns an error if BridgeOutput::function_line fails.

Source

fn function_line(input: &mut &str) -> ModalResult<RawPackageName>

Recognizes a RawPackageName in a string slice.

§Errors

Returns an error if no RawPackageName can be found in input.

Trait Implementations§

Source§

impl Clone for BridgeOutput

Source§

fn clone(&self) -> BridgeOutput

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for BridgeOutput

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> 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> 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> 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, 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,