Trait StringMatchers

Source
pub trait StringMatchers {
    // Required methods
    fn to_be_empty(self) -> Self;
    fn to_have_length(self, expected: usize) -> Self;
    fn to_contain(self, substring: &str) -> Self;
    fn to_contain_substring(self, substring: &str) -> Self;
    fn to_start_with(self, prefix: &str) -> Self;
    fn to_end_with(self, suffix: &str) -> Self;
    fn to_match(self, pattern: &str) -> Self;
}
Expand description

Trait for string assertions

Required Methods§

Source

fn to_be_empty(self) -> Self

Source

fn to_have_length(self, expected: usize) -> Self

Source

fn to_contain(self, substring: &str) -> Self

Check if the string contains a substring

Source

fn to_contain_substring(self, substring: &str) -> Self

Type-specific version of to_contain to avoid trait conflicts

Source

fn to_start_with(self, prefix: &str) -> Self

Source

fn to_end_with(self, suffix: &str) -> Self

Source

fn to_match(self, pattern: &str) -> Self

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§

Source§

impl<V> StringMatchers for Assertion<V>
where V: AsString + Debug + Clone,