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.
Sourcepub fn variable_character(input: &mut &str) -> ModalResult<char>
pub fn variable_character(input: &mut &str) -> ModalResult<char>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)