add ability to format Row correctly

This commit is contained in:
2026-03-03 14:17:02 -06:00
parent 33a8ebd260
commit e73ba7f33f

View File

@@ -13,6 +13,8 @@ pub struct Row {
} }
impl Row { impl Row {
const DF: &str = "%Y-%m-%d %H:%M";
pub fn new( pub fn new(
name: &str, name: &str,
hut_type: &str, hut_type: &str,
@@ -71,3 +73,25 @@ fn make_checksum() -> String {
format!("{}{}", base, last) format!("{}{}", base, last)
} }
impl std::fmt::Display for Row {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{},{},{},{},{},N,{},{},{},{},{},{},{},{}",
self.name,
self.name,
self.hut_type,
self.path,
self.tare,
self.mat_id,
self.quantity,
self.lot_id,
self.uom,
self.lot_status,
self.born.format(Self::DF),
self.born.format(Self::DF),
self.expire.format(Self::DF),
)
}
}