use std::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum WithOptions {
Tokens,
None,
Ids,
Labels,
Keys,
Values,
All,
Indexer,
List,
Map,
}
impl WithOptions {
pub fn name(self) -> &'static str {
match self {
WithOptions::Tokens => "tokens",
WithOptions::None => "none",
WithOptions::Ids => "ids",
WithOptions::Labels => "labels",
WithOptions::Keys => "keys",
WithOptions::Values => "values",
WithOptions::All => "all",
WithOptions::Indexer => "indexer",
WithOptions::List => "list",
WithOptions::Map => "map",
}
}
#[cfg_attr(not(feature = "script"), allow(dead_code))]
pub(crate) const ALL: [WithOptions; 10] = [
WithOptions::Tokens,
WithOptions::None,
WithOptions::Ids,
WithOptions::Labels,
WithOptions::Keys,
WithOptions::Values,
WithOptions::All,
WithOptions::Indexer,
WithOptions::List,
WithOptions::Map,
];
}
impl fmt::Display for WithOptions {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "WithOptions.{}", self.name())
}
}