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<SelectWhen, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SelectWhen, <__D as Deserializer<'de>>::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 ==.Source§impl Serialize for SelectWhen
impl Serialize for SelectWhen
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for SelectWhen
impl StructuralPartialEq for SelectWhen
Auto Trait Implementations§
impl Freeze for SelectWhen
impl RefUnwindSafe for SelectWhen
impl Send for SelectWhen
impl Sync for SelectWhen
impl Unpin for SelectWhen
impl UnsafeUnpin for SelectWhen
impl UnwindSafe for SelectWhen
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.