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]

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"));

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]

Formats the value using the given formatter. Read more

impl Clone for DifferencePredicate
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for DifferencePredicate
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for DifferencePredicate
[src]

impl Predicate<str> for DifferencePredicate
[src]

Execute this Predicate against variable, returning the resulting boolean. Read more

Find a case that proves this predicate as expected when run against variable.

impl PredicateReflection for DifferencePredicate
[src]

Important traits for Box<R>

Parameters of the current Predicate.

Important traits for Box<R>

Nested Predicates of the current Predicate.

impl Display for DifferencePredicate
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations