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