pub struct Overrides {
pub rules: Vec<OverrideRule>,
pub regex_cache: HashMap<String, Regex>,
}Expand description
Container for override rules with performance optimizations
Fields§
§rules: Vec<OverrideRule>Loaded override rules to apply to responses
regex_cache: HashMap<String, Regex>Compiled regex patterns for performance (cached compilation)
Implementations§
Source§impl Overrides
impl Overrides
Sourcepub async fn load_from_globs(patterns: &[&str]) -> Result<Self>
pub async fn load_from_globs(patterns: &[&str]) -> Result<Self>
Load overrides from glob patterns, with support for MOCKFORGE_HTTP_OVERRIDES_GLOB
Source§impl Overrides
impl Overrides
Sourcepub fn rules(&self) -> &[OverrideRule]
pub fn rules(&self) -> &[OverrideRule]
Get the loaded override rules
Sourcepub fn apply(
&self,
operation_id: &str,
tags: &[String],
path: &str,
body: &mut Value,
)
pub fn apply( &self, operation_id: &str, tags: &[String], path: &str, body: &mut Value, )
Apply overrides to a response body using default condition context
Sourcepub fn apply_with_context(
&self,
operation_id: &str,
tags: &[String],
path: &str,
body: &mut Value,
context: &ConditionContext,
)
pub fn apply_with_context( &self, operation_id: &str, tags: &[String], path: &str, body: &mut Value, context: &ConditionContext, )
Apply overrides with condition evaluation
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Overrides
impl<'de> Deserialize<'de> for Overrides
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Overrides
impl RefUnwindSafe for Overrides
impl Send for Overrides
impl Sync for Overrides
impl Unpin for Overrides
impl UnwindSafe for Overrides
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more