pub enum Value {
Single(String),
Array(Vec<String>),
}Expand description
A single value or a list of values declared in the output of the alpm-pkgbuild-bridge script.
Both parser functions ensure that at least one value exists.
Variants§
Implementations§
Source§impl Value
impl Value
Sourcepub fn as_vec(&self) -> Vec<&String>
pub fn as_vec(&self) -> Vec<&String>
Returns the values of &self in vector representation.
This is useful for values that may be available as both single values and arrays.
Sourcepub fn as_owned_vec(self) -> Vec<String>
pub fn as_owned_vec(self) -> Vec<String>
Returns the values of self in vector representation.
This is useful for values that may be available as both single values and arrays.
Sourcepub fn has_value(&self) -> bool
pub fn has_value(&self) -> bool
Checks whether this holds a value.
Returns true if self is Value::Single (they always have a value set by definition),
or if self is Value::Array and contains at least one element.
Returns false in all other cases.
Sourcepub fn parse_next_value(input: &mut &str) -> ModalResult<String>
pub fn parse_next_value(input: &mut &str) -> ModalResult<String>
Recognizes a Value::Single in a string slice.
Calls Value::variable_character to handle escaped characters in input.
§Examples
"This is a string value\" with escaped \\ characters"§Errors
Returns an error if no Value::Single is found in input.