1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use crate::core::display::PrintDebug;
use crate::core::information::{FromMacro, Information};
use crate::core::should::{Should, ShouldImpl};
use std::fmt::Debug;
#[derive(Debug)]
#[must_use]
pub struct LeftElement<L: Debug> {
left: L,
from_macro: FromMacro,
}
impl<L: Debug> LeftElement<L> {
pub fn new(
left: L,
stringified: &'static str,
location: &'static str,
case: Option<&'static str>,
) -> Self {
let from_macro = FromMacro {
stringified,
location,
case,
};
LeftElement { left, from_macro }
}
pub fn should(self) -> Should<L> {
let LeftElement { left, from_macro } = self;
let left_dbg = left.dbg().to_string();
let info = Information::new(Some(from_macro), left_dbg);
Should(ShouldImpl {
truthness: true,
left: Some(left),
info,
})
}
}