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§
fn to_be_empty(self) -> Self
fn to_have_length(self, expected: usize) -> Self
Sourcefn to_contain(self, substring: &str) -> Self
fn to_contain(self, substring: &str) -> Self
Check if the string contains a substring
Sourcefn to_contain_substring(self, substring: &str) -> Self
fn to_contain_substring(self, substring: &str) -> Self
Type-specific version of to_contain to avoid trait conflicts
fn to_start_with(self, prefix: &str) -> Self
fn to_end_with(self, suffix: &str) -> Self
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.