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]

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

[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]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for DifferencePredicate
[src]

[src]

Formats the value using the given formatter. Read more

impl Predicate<str> for DifferencePredicate
[src]

[src]

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

impl Display for DifferencePredicate
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations