pub struct Params(/* private fields */);Implementations§
Source§impl Params
impl Params
Sourcepub fn from_raw(raw: &str) -> Self
pub fn from_raw(raw: &str) -> Self
Parse a pipe-delimited DSL string into parameters.
Handles both Key$ Value and Key$Value (no trailing space) formats.
Mirrors Java’s FileSection.parseToMap().
Sourcepub fn from_parsed(parsed: &ParsedParams<'_>) -> Self
pub fn from_parsed(parsed: &ParsedParams<'_>) -> Self
Create owned compatibility params from a zero-copy parsed script.
Duplicate keys intentionally keep Java/map compatibility: later entries overwrite earlier entries.
Sourcepub fn from_map(map: BTreeMap<String, String>) -> Self
pub fn from_map(map: BTreeMap<String, String>) -> Self
Create from an existing map (for migration from raw BTreeMap).
Sourcepub fn inner(&self) -> &BTreeMap<String, String>
pub fn inner(&self) -> &BTreeMap<String, String>
Access the underlying map (escape hatch for incremental migration).
Sourcepub fn into_inner(self) -> BTreeMap<String, String>
pub fn into_inner(self) -> BTreeMap<String, String>
Consume and return the underlying map.
Sourcepub fn get<K: AsRef<str>>(&self, key: K) -> Option<&str>
pub fn get<K: AsRef<str>>(&self, key: K) -> Option<&str>
Get a parameter value by key.
Mirrors Java’s CardTraitBase.getParam(String).
Sourcepub fn get_or_default<'a, K: AsRef<str>>(
&'a self,
key: K,
default: &'a str,
) -> &'a str
pub fn get_or_default<'a, K: AsRef<str>>( &'a self, key: K, default: &'a str, ) -> &'a str
Get a parameter value or a default.
Mirrors Java’s CardTraitBase.getParamOrDefault(String, String).
Sourcepub fn has<K: AsRef<str>>(&self, key: K) -> bool
pub fn has<K: AsRef<str>>(&self, key: K) -> bool
Check if a parameter key exists.
Mirrors Java’s CardTraitBase.hasParam(String).
Sourcepub fn put(&mut self, key: String, value: String)
pub fn put(&mut self, key: String, value: String)
Set a parameter value.
Mirrors Java’s CardTraitBase.putParam(String, String).
Sourcepub fn remove<K: AsRef<str>>(&mut self, key: K) -> Option<String>
pub fn remove<K: AsRef<str>>(&mut self, key: K) -> Option<String>
Remove a parameter and return its value.
Mirrors Java’s CardTraitBase.removeParam(String).
Sourcepub fn contains_any_key(&self, keys: &[&str]) -> bool
pub fn contains_any_key(&self, keys: &[&str]) -> bool
Check whether any key exists without recording accessor instrumentation.
Intended for coarse hot-path gates before a caller decides whether to perform many instrumented typed lookups.
Sourcepub fn is_true<K: AsRef<str>>(&self, key: K) -> bool
pub fn is_true<K: AsRef<str>>(&self, key: K) -> bool
Check if a boolean param is set to “True” (case-insensitive).
Mirrors the common Java pattern "True".equals(getParam(key)).
Sourcepub fn as_i32<K: AsRef<str>>(&self, key: K) -> Option<i32>
pub fn as_i32<K: AsRef<str>>(&self, key: K) -> Option<i32>
Parse a parameter as i32, returning None if absent or non-numeric.
Sourcepub fn as_usize<K: AsRef<str>>(&self, key: K) -> Option<usize>
pub fn as_usize<K: AsRef<str>>(&self, key: K) -> Option<usize>
Parse a parameter as usize, returning None if absent or non-numeric.
Sourcepub fn zone_type<K: AsRef<str>>(&self, key: K) -> Option<ZoneType>
pub fn zone_type<K: AsRef<str>>(&self, key: K) -> Option<ZoneType>
Parse a parameter as a single zone type.
Sourcepub fn zone_types<K: AsRef<str>>(&self, key: K) -> Vec<ZoneType>
pub fn zone_types<K: AsRef<str>>(&self, key: K) -> Vec<ZoneType>
Parse a parameter as a comma-separated zone list.
Sourcepub fn selector_value<K: AsRef<str>>(&self, key: K) -> Option<&str>
pub fn selector_value<K: AsRef<str>>(&self, key: K) -> Option<&str>
Get a selector-like parameter, asserting that semantic classification agrees with selector/reference usage while preserving the legacy raw string consumed by current matchers.
Sourcepub fn selector<K: AsRef<str>>(&self, key: K) -> Option<&CompiledSelector>
pub fn selector<K: AsRef<str>>(&self, key: K) -> Option<&CompiledSelector>
Get a compiled selector-like parameter.
pub fn selector_untracked<K: AsRef<str>>( &self, key: K, ) -> Option<&CompiledSelector>
Sourcepub fn selector_cloned<K: AsRef<str>>(&self, key: K) -> Option<CompiledSelector>
pub fn selector_cloned<K: AsRef<str>>(&self, key: K) -> Option<CompiledSelector>
Get an owned compiled selector-like parameter.
This is used when trigger/effect structs cache a filter for repeated
execution. It prefers the parser-produced IR and falls back to compiling
the raw value as a selector for compatibility with less-specific
historical keys like ValidToken.
pub fn selector_cloned_any(&self, keys: &[&str]) -> Option<CompiledSelector>
Sourcepub fn reference_value<K: AsRef<str>>(&self, key: K) -> Option<&str>
pub fn reference_value<K: AsRef<str>>(&self, key: K) -> Option<&str>
Get a reference-like parameter, asserting that semantic classification agrees with reference usage while preserving the legacy raw string.
Sourcepub fn reference<K: AsRef<str>>(&self, key: K) -> Option<&CompiledSelector>
pub fn reference<K: AsRef<str>>(&self, key: K) -> Option<&CompiledSelector>
Get a compiled reference-like parameter.
Sourcepub fn get_cloned(&self, key: &str) -> Option<String>
pub fn get_cloned(&self, key: &str) -> Option<String>
Get a parameter value, cloning it into an owned String.
Sourcepub fn split_param_list<K: AsRef<str>>(
&self,
key: K,
delimiter: &str,
) -> Vec<String>
pub fn split_param_list<K: AsRef<str>>( &self, key: K, delimiter: &str, ) -> Vec<String>
Split a delimited parameter value into trimmed, non-empty owned parts.
Sourcepub fn semantic_value<K: AsRef<str>>(
&self,
key: K,
) -> Option<SemanticParamValue<'_>>
pub fn semantic_value<K: AsRef<str>>( &self, key: K, ) -> Option<SemanticParamValue<'_>>
Get a parameter value lowered through the semantic Forge DSL classifier.
This borrows the stored value and falls back to SemanticParamValue::Raw
for keys that are intentionally not classified yet.
Sourcepub fn require(&self, key: &str, context: &str) -> Option<&str>
pub fn require(&self, key: &str, context: &str) -> Option<&str>
Get a required parameter, logging a warning if missing.
Use this instead of .get() when the parameter is expected to exist.
Missing parameters are logged with context for debugging card scripts.