Trait StringAssertion

Source
pub trait StringAssertion<R> {
    // Required methods
    fn is_same_string_to<E: Into<String>>(&self, expected: E) -> R;
    fn contains<E: Into<String>>(&self, expected: E) -> R;
    fn does_not_contain<E: Into<String>>(&self, value: E) -> R;
    fn starts_with<E: Into<String>>(&self, expected: E) -> R;
    fn ends_with<E: Into<String>>(&self, expected: E) -> R;
}
Expand description

Trait for string assertion.

§Example

use assertor::*;

assert_that!("foobarbaz").is_same_string_to("foobarbaz");
assert_that!("foobarbaz").contains("bar");
assert_that!("foobarbaz").starts_with("foo");
assert_that!("foobarbaz").ends_with("baz");

Required Methods§

Source

fn is_same_string_to<E: Into<String>>(&self, expected: E) -> R

Checks that the subject is same string to expected.

Source

fn contains<E: Into<String>>(&self, expected: E) -> R

Checks that the subject contains expected.

Source

fn does_not_contain<E: Into<String>>(&self, value: E) -> R

Checks that the subject does not contains value.

Source

fn starts_with<E: Into<String>>(&self, expected: E) -> R

Checks that the subject starts with expected.

Source

fn ends_with<E: Into<String>>(&self, expected: E) -> R

Checks that the subject ends with expected.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§