pub struct Bindings { /* private fields */ }Expand description
Wildcard bindings produced by a successful match: wildcard name → matched sub-expression.
Names are the symbol names used in the rule’s left-hand side
(including the trailing underscore), e.g. "a_" or "rest__".
§Examples
use symplex::prelude::*;
use symplex::macros::Rule;
let ctx = Context::new();
let (x, y, a, b) = (ctx.symbol("x"), ctx.symbol("y"), ctx.symbol("a_"), ctx.symbol("b_"));
let rule = Rule::new("swap", &a.pow(&b), &b.pow(&a));
let bindings = rule.matches(&x.pow(&y)).unwrap();
assert_eq!(bindings.get("a_"), Some(&x));
assert_eq!(bindings.get("b_"), Some(&y));
assert_eq!(bindings.len(), 2);Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Bindings
impl !UnwindSafe for Bindings
impl Freeze for Bindings
impl Send for Bindings
impl Sync for Bindings
impl Unpin for Bindings
impl UnsafeUnpin for Bindings
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more