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,
})
}
}