Struct predicates::str::DifferencePredicate [−][src]
pub struct DifferencePredicate { /* fields omitted */ }
Predicate that diffs two strings.
This is created by the predicate::str::similar
.
Methods
impl DifferencePredicate
[src]
impl DifferencePredicate
pub fn split<S>(self, split: S) -> Self where
S: Into<Cow<'static, str>>,
[src]
pub fn split<S>(self, split: S) -> Self where
S: Into<Cow<'static, str>>,
The split used when identifying changes.
Common splits include:
""
for char-level." "
for word-level."\n"
for line-level.
Default: "\n"
Examples
use predicates::prelude::*; let predicate_fn = predicate::str::similar("Hello World").split(" "); assert_eq!(true, predicate_fn.eval("Hello World"));
pub fn distance(self, distance: i32) -> Self
[src]
pub fn distance(self, distance: i32) -> Self
The maximum allowed edit distance.
Default: 0
Examples
use predicates::prelude::*; let predicate_fn = predicate::str::similar("Hello World!").split("").distance(1); assert_eq!(true, predicate_fn.eval("Hello World!")); assert_eq!(true, predicate_fn.eval("Hello World")); assert_eq!(false, predicate_fn.eval("Hello World?"));
Trait Implementations
impl Debug for DifferencePredicate
[src]
impl Debug for DifferencePredicate
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for DifferencePredicate
[src]
impl Clone for DifferencePredicate
fn clone(&self) -> DifferencePredicate
[src]
fn clone(&self) -> DifferencePredicate
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl PartialEq for DifferencePredicate
[src]
impl PartialEq for DifferencePredicate
fn eq(&self, other: &DifferencePredicate) -> bool
[src]
fn eq(&self, other: &DifferencePredicate) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &DifferencePredicate) -> bool
[src]
fn ne(&self, other: &DifferencePredicate) -> bool
This method tests for !=
.
impl Eq for DifferencePredicate
[src]
impl Eq for DifferencePredicate
impl Predicate<str> for DifferencePredicate
[src]
impl Predicate<str> for DifferencePredicate
fn eval(&self, edit: &str) -> bool
[src]
fn eval(&self, edit: &str) -> bool
Execute this Predicate
against variable
, returning the resulting boolean. Read more
fn find_case<'a>(&'a self, expected: bool, variable: &str) -> Option<Case<'a>>
[src]
fn find_case<'a>(&'a self, expected: bool, variable: &str) -> Option<Case<'a>>
Find a case that proves this predicate as expected
when run against variable
.
impl PredicateReflection for DifferencePredicate
[src]
impl PredicateReflection for DifferencePredicate
ⓘImportant traits for Box<R>fn parameters<'a>(&'a self) -> Box<Iterator<Item = Parameter<'a>> + 'a>
[src]
ⓘImportant traits for Box<R>
fn parameters<'a>(&'a self) -> Box<Iterator<Item = Parameter<'a>> + 'a>
Parameters of the current Predicate
.
ⓘImportant traits for Box<R>fn children(&'a self) -> Box<Iterator<Item = Child<'a>> + 'a>
[src]
ⓘImportant traits for Box<R>
fn children(&'a self) -> Box<Iterator<Item = Child<'a>> + 'a>
Nested Predicate
s of the current Predicate
.
impl Display for DifferencePredicate
[src]
impl Display for DifferencePredicate
Auto Trait Implementations
impl Send for DifferencePredicate
impl Send for DifferencePredicate
impl Sync for DifferencePredicate
impl Sync for DifferencePredicate