From 5efa3c9663ec7c5782040c4958a5f81cc5fdd7bd Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Mon, 28 Apr 2025 23:36:51 -0400 Subject: [PATCH] Add EXD::get_row function --- src/exd.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/exd.rs b/src/exd.rs index 8abed58..78ddb54 100644 --- a/src/exd.rs +++ b/src/exd.rs @@ -185,7 +185,7 @@ pub struct EXD { pub rows: Vec, } -#[derive(Debug)] +#[derive(Debug, Clone)] pub enum ColumnData { String(String), Bool(bool), @@ -200,12 +200,12 @@ pub enum ColumnData { UInt64(u64), } -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct ExcelSingleRow { pub columns: Vec, } -#[derive(Debug)] +#[derive(Debug, Clone)] pub enum ExcelRowKind { SingleRow(ExcelSingleRow), SubRows(Vec), @@ -222,6 +222,16 @@ impl EXD { EXD::read_args(&mut Cursor::new(&buffer), (exh,)).ok() } + pub fn get_row(&self, row_id: u32) -> Option { + for row in &self.rows { + if row.row_id == row_id { + return Some(row.kind.clone()); + } + } + + return None; + } + fn read_data_raw = ()>>(cursor: &mut T) -> Option { Z::read_options(cursor, Endian::Big, ()).ok() }