2024-12-28 20:58:19 -06:00
|
|
|
#[cfg(feature = "codegen")]
|
|
|
|
pub struct DictGen<'g> {
|
|
|
|
pub(crate) name: &'g str,
|
|
|
|
pub(crate) value_type: &'g str,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl DictGen<'static> {
|
|
|
|
pub fn new() -> Self {
|
|
|
|
Self {
|
|
|
|
name: "DICT",
|
|
|
|
value_type: "&'static str",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'g> DictGen<'g> {
|
|
|
|
pub fn name<'n>(self, name: &'n str) -> DictGen<'n>
|
|
|
|
where
|
|
|
|
'g: 'n,
|
|
|
|
{
|
|
|
|
DictGen {
|
|
|
|
name,
|
|
|
|
value_type: self.value_type,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn value_type<'t>(self, value_type: &'t str) -> DictGen<'t>
|
|
|
|
where
|
|
|
|
'g: 't,
|
|
|
|
{
|
|
|
|
DictGen {
|
|
|
|
name: self.name,
|
|
|
|
value_type,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(feature = "map")]
|
2024-12-30 14:57:39 -06:00
|
|
|
pub fn map(self) -> crate::MapGen<'g> {
|
2024-12-30 16:29:20 -06:00
|
|
|
crate::MapGen {
|
|
|
|
gen: self,
|
|
|
|
unicode: true,
|
|
|
|
unicase: true,
|
|
|
|
}
|
2024-12-28 20:58:19 -06:00
|
|
|
}
|
|
|
|
|
2024-12-30 14:57:39 -06:00
|
|
|
pub fn ordered_map(self) -> crate::OrderedMapGen<'g> {
|
2024-12-30 16:13:35 -06:00
|
|
|
crate::OrderedMapGen {
|
|
|
|
gen: self,
|
|
|
|
unicode: true,
|
|
|
|
unicase: true,
|
|
|
|
}
|
2024-12-28 20:58:19 -06:00
|
|
|
}
|
|
|
|
|
2024-12-30 14:57:39 -06:00
|
|
|
pub fn trie(self) -> crate::TrieGen<'g> {
|
|
|
|
crate::TrieGen {
|
2024-12-28 20:58:19 -06:00
|
|
|
gen: self,
|
|
|
|
limit: 64,
|
|
|
|
}
|
|
|
|
}
|
2024-12-30 20:55:12 -06:00
|
|
|
|
|
|
|
pub fn r#match(self) -> crate::MatchGen<'g> {
|
|
|
|
crate::MatchGen { gen: self }
|
|
|
|
}
|
2024-12-28 20:58:19 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for DictGen<'static> {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self::new()
|
|
|
|
}
|
|
|
|
}
|