Skip to main content

strategy_pattern_type

Attribute Macro strategy_pattern_type 

Source
#[strategy_pattern_type]
Expand description

Attribute macro to define a strategy type.

This macro should be applied to a struct that will serve as a strategy container. It allows defining a type that will store function pointers and execute them dynamically.

§Parameters

  • search: Defines the search mode for function keys. It can be:
    • "Exact" → Exact match.
    • "IgnoreCase" → Case-insensitive match.
    • "RegExp" → Uses regular expressions.

§Example

#[strategy_pattern_type(search = "IgnoreCase")]
pub struct GreetingStrategy(fn(String) -> String);