Skip to main content

Params

Struct Params 

Source
pub struct Params(/* private fields */);

Implementations§

Source§

impl Params

Source

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().

Source

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.

Source

pub fn from_map(map: BTreeMap<String, String>) -> Self

Create from an existing map (for migration from raw BTreeMap).

Source

pub fn inner(&self) -> &BTreeMap<String, String>

Access the underlying map (escape hatch for incremental migration).

Source

pub fn into_inner(self) -> BTreeMap<String, String>

Consume and return the underlying map.

Source

pub fn get<K: AsRef<str>>(&self, key: K) -> Option<&str>

Get a parameter value by key. Mirrors Java’s CardTraitBase.getParam(String).

Source

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).

Source

pub fn has<K: AsRef<str>>(&self, key: K) -> bool

Check if a parameter key exists. Mirrors Java’s CardTraitBase.hasParam(String).

Source

pub fn put(&mut self, key: String, value: String)

Set a parameter value. Mirrors Java’s CardTraitBase.putParam(String, String).

Source

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).

Source

pub fn is_empty(&self) -> bool

Check if the map is empty.

Source

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.

Source

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)).

Source

pub fn as_i32<K: AsRef<str>>(&self, key: K) -> Option<i32>

Parse a parameter as i32, returning None if absent or non-numeric.

Source

pub fn as_usize<K: AsRef<str>>(&self, key: K) -> Option<usize>

Parse a parameter as usize, returning None if absent or non-numeric.

Source

pub fn zone_type<K: AsRef<str>>(&self, key: K) -> Option<ZoneType>

Parse a parameter as a single zone type.

Source

pub fn zone_types<K: AsRef<str>>(&self, key: K) -> Vec<ZoneType>

Parse a parameter as a comma-separated zone list.

Source

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.

Source

pub fn selector<K: AsRef<str>>(&self, key: K) -> Option<&CompiledSelector>

Get a compiled selector-like parameter.

Source

pub fn selector_untracked<K: AsRef<str>>( &self, key: K, ) -> Option<&CompiledSelector>

Source

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.

Source

pub fn selector_cloned_any(&self, keys: &[&str]) -> Option<CompiledSelector>

Source

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.

Source

pub fn reference<K: AsRef<str>>(&self, key: K) -> Option<&CompiledSelector>

Get a compiled reference-like parameter.

Source

pub fn get_cloned(&self, key: &str) -> Option<String>

Get a parameter value, cloning it into an owned String.

Source

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.

Source

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.

Source

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.

Source

pub fn require_cloned(&self, key: &str, context: &str) -> Option<String>

Get a required parameter as an owned String, logging if missing.

Source

pub fn iter(&self) -> impl Iterator<Item = (&str, &str)>

Iterate over all key-value pairs.

Trait Implementations§

Source§

impl Clone for Params

Source§

fn clone(&self) -> Params

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Params

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Params

Source§

fn default() -> Params

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Params

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<BTreeMap<String, String>> for Params

Source§

fn from(map: BTreeMap<String, String>) -> Self

Converts to this type from the input type.
Source§

impl From<Params> for BTreeMap<String, String>

Source§

fn from(params: Params) -> Self

Converts to this type from the input type.
Source§

impl Serialize for Params

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V