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]
pub fn split<S>(self, split: S) -> Self where
S: Into<Cow<'static, str>>,
[src]
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]
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 Clone for DifferencePredicate
[src]
fn clone(&self) -> DifferencePredicate
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for DifferencePredicate
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Predicate<str> for DifferencePredicate
[src]
fn eval(&self, edit: &str) -> bool
[src]
Execute this Predicate
against variable
, returning the resulting boolean. Read more