pub struct Captures { /* private fields */ }Expand description
The capture block of a request, exactly as it appears on disk: variable
name to CaptureSource.
A map with author-chosen keys, so unlike every struct in Sendra’s schema
there is no deny_unknown_fields to apply — every key here is data. The
rule that a typo must not pass silently still holds, one level down: a path
that selects nothing is a reported failure rather than a variable that
quietly does not exist.
Names are not validated against a pattern. A variable is whatever
{{...}} can spell, and an environment file has never restricted its own
keys either; a name nothing references is harmless, and one that cannot be
referenced is a mistake visible the moment it is used.
Implementations§
Source§impl Captures
impl Captures
Sourcepub fn entries(&self) -> &BTreeMap<String, CaptureSource>
pub fn entries(&self) -> &BTreeMap<String, CaptureSource>
The name-to-source pairs, sorted by name.
Sourcepub fn evaluate(
&self,
response: &Response,
environment: &Environment,
) -> CaptureReport
pub fn evaluate( &self, response: &Response, environment: &Environment, ) -> CaptureReport
Extract every value this block names from response.
environment is read for one thing only: a captured name that the
environment file already defines is rejected rather than allowed to
shadow it. See CaptureFailure::Shadowed for that decision.
Entries are evaluated in sorted-name order and none short-circuits the
others, so a report always has exactly one result per entry — the same
contract AssertionReport makes.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Captures
impl<'de> Deserialize<'de> for Captures
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>,
impl Eq for Captures
Source§impl FromIterator<(String, CaptureSource)> for Captures
impl FromIterator<(String, CaptureSource)> for Captures
Source§fn from_iter<T: IntoIterator<Item = (String, CaptureSource)>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = (String, CaptureSource)>>(iter: T) -> Self
impl StructuralPartialEq for Captures
Auto Trait Implementations§
impl Freeze for Captures
impl RefUnwindSafe for Captures
impl Send for Captures
impl Sync for Captures
impl Unpin for Captures
impl UnsafeUnpin for Captures
impl UnwindSafe for Captures
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.