[][src]Trait fluid::traits::string::ShouldString

pub trait ShouldString<S: Debug> where
    S: AsRef<str>, 
{ fn contain<P>(self, right: P) -> ChainableAssert<ContainString<S, P>>
    where
        P: StringPattern
;
fn start_with<P>(self, right: P) -> ChainableAssert<StartWithString<S, P>>
    where
        P: StringPattern
;
fn end_with<P>(self, right: P) -> ChainableAssert<EndWithString<S, P>>
    where
        P: StringPattern
;
fn be_empty(self) -> ChainableAssert<BeEmptyString<S>>; }

Extension for Should<AsRef>. See the method documentation.

Required methods

fn contain<P>(self, right: P) -> ChainableAssert<ContainString<S, P>> where
    P: StringPattern

Checks that a string contains a pattern.

Example

"Hello".should().contain('l');
"Hello".should().contain("ll");
"Hello".should().contain(['a', 'e', 'i']);
"Hello".should().not().contain(|c: char| c.is_numeric());

fn start_with<P>(self, right: P) -> ChainableAssert<StartWithString<S, P>> where
    P: StringPattern

Checks that a string begins with a pattern.

Example

"Hello".should().start_with("He");

fn end_with<P>(self, right: P) -> ChainableAssert<EndWithString<S, P>> where
    P: StringPattern

Checks that a string ends with a pattern.

Example

"Hello".should().end_with('o');

fn be_empty(self) -> ChainableAssert<BeEmptyString<S>>

Checks that a string is empty.

Example

"Hello".should().not().be_empty();
Loading content...

Implementors

impl<S: Debug> ShouldString<S> for Should<S> where
    S: AsRef<str>, 
[src]

Loading content...