pub struct SelectWhen {
pub category: Option<String>,
pub id_prefix: Option<String>,
pub id_glob: Option<String>,
pub tag: Option<String>,
pub input_has: Option<String>,
}Expand description
Condition for auto-selecting a named call config when the fixture matches.
When a fixture does not specify "call", the codegen normally uses the default
[e2e.call]. A SelectWhen condition on a named call allows automatic routing
based on the fixture’s id, category, tags, or input shape. All set fields must
match (logical AND); a condition with no fields set never matches.
[e2e.calls.batch_scrape]
select_when = { input_has = "batch_urls" }
[e2e.calls.crawl]
select_when = { category = "crawl" }
[e2e.calls.batch_crawl_stream]
select_when = { category = "stream", id_prefix = "batch_crawl_stream" }Fields§
§category: Option<String>Match when the fixture’s resolved category equals this string.
id_prefix: Option<String>Match when the fixture’s id starts with this prefix.
id_glob: Option<String>Match when the fixture’s id matches this simple glob.
Only * (matches any run of characters) is supported. Use id_prefix
for plain prefix matches.
tag: Option<String>Match when the fixture’s tags include this tag.
input_has: Option<String>Match when the fixture’s input object contains this key with a non-null value.
Implementations§
Source§impl SelectWhen
impl SelectWhen
Sourcepub fn matches(
&self,
fixture_id: &str,
fixture_category: &str,
fixture_tags: &[String],
fixture_input: &Value,
) -> bool
pub fn matches( &self, fixture_id: &str, fixture_category: &str, fixture_tags: &[String], fixture_input: &Value, ) -> bool
Returns true when every set discriminator matches the fixture.
A SelectWhen with all fields None returns false — at least one
discriminator must be set for the condition to fire.
Trait Implementations§
Source§impl Clone for SelectWhen
impl Clone for SelectWhen
Source§fn clone(&self) -> SelectWhen
fn clone(&self) -> SelectWhen
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SelectWhen
impl Debug for SelectWhen
Source§impl Default for SelectWhen
impl Default for SelectWhen
Source§fn default() -> SelectWhen
fn default() -> SelectWhen
Source§impl<'de> Deserialize<'de> for SelectWhen
impl<'de> Deserialize<'de> for SelectWhen
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>,
Source§impl PartialEq for SelectWhen
impl PartialEq for SelectWhen
Source§fn eq(&self, other: &SelectWhen) -> bool
fn eq(&self, other: &SelectWhen) -> bool
self and other values to be equal, and is used by ==.