pub struct Binding { /* private fields */ }
Expand description
A binding of a scenario step to its implementation.
Contains the pattern used to match against scenario steps, combined with the step kind. The pattern is a regular expression as understood by the regex crate.
Implementations
sourceimpl Binding
impl Binding
sourcepub fn new(
kind: StepKind,
pattern: &str,
case_sensitive: bool,
types: HashMap<String, CaptureType>
) -> Result<Binding, SubplotError>
pub fn new(
kind: StepKind,
pattern: &str,
case_sensitive: bool,
types: HashMap<String, CaptureType>
) -> Result<Binding, SubplotError>
Create a new Binding, from a step kind and a pattern.
sourcepub fn add_impl(&mut self, template: &str, function: &str, cleanup: Option<&str>)
pub fn add_impl(&mut self, template: &str, function: &str, cleanup: Option<&str>)
Insert an impl into this binding
sourcepub fn step_impl(&self, template: &str) -> Option<Arc<BindingImpl>>
pub fn step_impl(&self, template: &str) -> Option<Arc<BindingImpl>>
Retrieve a particular implementation by name
sourcepub fn regex(&self) -> &Regex
pub fn regex(&self) -> &Regex
Return the compiled regular expression for the pattern of the binding.
The regular expression matches the whole text of a scenario step.
sourcepub fn types(&self) -> impl Iterator<Item = (&str, CaptureType)>
pub fn types(&self) -> impl Iterator<Item = (&str, CaptureType)>
Return the type bindings for this binding.
sourcepub fn match_with_step(
&self,
template: &str,
step: &ScenarioStep
) -> Option<MatchedStep>
pub fn match_with_step(
&self,
template: &str,
step: &ScenarioStep
) -> Option<MatchedStep>
Try to match defined binding against a parsed scenario step.
Trait Implementations
impl Eq for Binding
Auto Trait Implementations
impl RefUnwindSafe for Binding
impl Send for Binding
impl Sync for Binding
impl Unpin for Binding
impl UnwindSafe for Binding
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.