use sprinklers_core::model::Zone; use rusqlite::{Error as SqlError, Row as SqlRow, ToSql}; pub fn from_sql<'a>(row: &SqlRow<'a>) -> Result { Ok(Zone { id: row.get(0)?, name: row.get(1)?, interface_id: row.get(2)?, }) } #[allow(dead_code)] pub fn as_sql(zone: &Zone) -> Vec<&dyn ToSql> { vec![&zone.id, &zone.name, &zone.interface_id] }