Struct k9::MultilineString[][src]

pub struct MultilineString(pub String);

assert_equal! takes a std::fmt::Debug trait object as an argument which doesn’t work well with multiline strings, since newline characters will be displayed as \n For example this string:

let s = "A
B
C";

will be printed as a single line "A\nB\nC", which is not useful for multiline comparison diff

Using this struct makes the original string serialize into a proper multiline string which will produce a nice line by line difference comparison when used together with assert_equal!.

use k9::{MultilineString, assert_equal};

let s1 = "A\nB\nC".to_string();
let s2 = "A\nD\nC";
assert_equal!(MultilineString(s1), MultilineString::new(s2));

Implementations

impl MultilineString[src]

pub fn new<S: Into<String>>(s: S) -> Self[src]

Trait Implementations

impl Debug for MultilineString[src]

Make diff to display string as multi-line string

impl Eq for MultilineString[src]

impl PartialEq<MultilineString> for MultilineString[src]

impl StructuralEq for MultilineString[src]

impl StructuralPartialEq for MultilineString[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> FormattableForComparison for T where
    T: Debug
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.