Enum compose_spec::ListOrMap
source · pub enum ListOrMap {
List(IndexSet<String>),
Map(Map),
}Expand description
A list of unique strings or a map with optional single values.
Variants§
Implementations§
source§impl ListOrMap
impl ListOrMap
sourcepub fn into_map(self) -> Result<Map, InvalidMapKeyError>
pub fn into_map(self) -> Result<Map, InvalidMapKeyError>
Attempt to convert into a map.
Split list items into keys and values on the ‘=’ character, i.e. {key}={value}. If an item
does not contain ‘=’, then the whole item is used as the key and the value is None.
If the value is an empty string, then it will also be converted to None.
Alias for self.into_map_split_on(&['=']).
§Errors
Returns an error if a key is not a valid MapKey.
sourcepub fn into_map_split_on(
self,
delimiters: &[char]
) -> Result<Map, InvalidMapKeyError>
pub fn into_map_split_on( self, delimiters: &[char] ) -> Result<Map, InvalidMapKeyError>
Attempt to convert into a map.
Split list items into keys and values with the delimiters. If an item does not contain a
delimiter, then the whole item is used as the key and the value is None.
If the value is an empty string, then it will also be converted to None.
§Errors
Returns an error if a key is not a valid MapKey.
Trait Implementations§
source§impl<'de> Deserialize<'de> for ListOrMap
impl<'de> Deserialize<'de> for ListOrMap
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for ListOrMap
impl PartialEq for ListOrMap
impl StructuralPartialEq for ListOrMap
Auto Trait Implementations§
impl Freeze for ListOrMap
impl RefUnwindSafe for ListOrMap
impl Send for ListOrMap
impl Sync for ListOrMap
impl Unpin for ListOrMap
impl UnwindSafe for ListOrMap
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