Struct subplot::Binding

source ·
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§

source§

impl Binding

source

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.

source

pub fn add_impl( &mut self, template: &str, function: &str, cleanup: Option<&str> )

Insert an impl into this binding

source

pub fn kind(&self) -> StepKind

Return the kind of step the binding is for.

source

pub fn pattern(&self) -> &str

Return text of pattern.

source

pub fn step_impl(&self, template: &str) -> Option<Arc<BindingImpl>>

Retrieve a particular implementation by name

source

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.

source

pub fn types(&self) -> impl Iterator<Item = (&str, CaptureType)>

Return the type bindings for this binding.

source

pub fn match_with_step( &self, template: &str, step: &ScenarioStep ) -> Option<MatchedStep>

Try to match defined binding against a parsed scenario step.

Trait Implementations§

source§

impl Clone for Binding

source§

fn clone(&self) -> Binding

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Binding

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq<Binding> for Binding

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Binding

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.