diff --git a/Cargo.toml b/Cargo.toml index fa4dcb09..940c92d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,28 +11,27 @@ description = "umya-spreadsheet is a library written in pure Rust to read and wr # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -aes = "0.8.3" -ahash = "0.8.7" +aes = "0.8.4" +ahash = "0.8.11" base64 = "0.22.1" byteorder = "1.5" cbc = "0.1.2" cfb = "0.10.0" -chrono = { version = "0.4.31", default-features = false, features = ["clock"] } -encoding_rs = "0.8.33" +chrono = { version = "0.4.38", default-features = false, features = ["clock"] } +encoding_rs = "0.8.35" fancy-regex = "0.14.0" -getrandom = { version = "0.2.14" } -hashbrown = "0.14.5" +getrandom = { version = "0.2.15" } hmac = "0.12.1" html_parser = "0.7.0" -image = { version = "0.25.0", optional = true } -lazy_static = "1.4.0" +image = { version = "0.25.5", optional = true } +lazy_static = "1.5.0" md-5 = "0.10.6" regex = "1.11.1" sha2 = "0.10.8" thin-vec = "0.2.13" thousands = "0.2.0" -quick-xml = { version = "0.36.2", features = ["serialize"] } -zip = { version = "1.1.4", default-features = false, features = ["deflate"] } +quick-xml = { version = "0.37.1", features = ["serialize"] } +zip = { version = "2.2.1", default-features = false, features = ["deflate"] } [lib] doctest = false diff --git a/src/helper/html.rs b/src/helper/html.rs index ad09b810..60bfc0dd 100644 --- a/src/helper/html.rs +++ b/src/helper/html.rs @@ -1,6 +1,6 @@ use chrono::format; -use hashbrown::HashMap; use html_parser::{Dom, Element, Node}; +use std::collections::HashMap; use structs::Color; use structs::Font; use structs::RichText; diff --git a/src/lib.rs b/src/lib.rs index 3e8d81db..e113e955 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -121,7 +121,6 @@ extern crate chrono; extern crate fancy_regex; -extern crate hashbrown; #[cfg(feature = "image")] extern crate image; extern crate md5; diff --git a/src/reader/xlsx/worksheet.rs b/src/reader/xlsx/worksheet.rs index fc9e12ff..983544ed 100644 --- a/src/reader/xlsx/worksheet.rs +++ b/src/reader/xlsx/worksheet.rs @@ -1,8 +1,8 @@ use super::driver::*; use super::XlsxError; -use hashbrown::HashMap; use quick_xml::events::Event; use quick_xml::Reader; +use std::collections::HashMap; use helper::formula::*; use structs::office2010::excel::DataValidations as DataValidations2010; diff --git a/src/structs/cell.rs b/src/structs/cell.rs index 21ca6375..7740d035 100644 --- a/src/structs/cell.rs +++ b/src/structs/cell.rs @@ -1,4 +1,3 @@ -use hashbrown::HashMap; use helper::coordinate::*; use helper::formula::*; use helper::number_format::*; @@ -7,6 +6,7 @@ use quick_xml::Reader; use quick_xml::Writer; use reader::driver::*; use std::borrow::Cow; +use std::collections::HashMap; use std::io::Cursor; use std::sync::{Arc, RwLock}; use structs::CellFormula; diff --git a/src/structs/cell_formula.rs b/src/structs/cell_formula.rs index f24fa1ba..2dca7811 100644 --- a/src/structs/cell_formula.rs +++ b/src/structs/cell_formula.rs @@ -1,4 +1,3 @@ -use hashbrown::HashMap; use helper::coordinate::*; use helper::formula::*; use quick_xml::de; @@ -6,6 +5,7 @@ use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; use reader::driver::*; +use std::collections::HashMap; use std::io::Cursor; use structs::BooleanValue; use structs::CellFormulaValues; diff --git a/src/structs/cells.rs b/src/structs/cells.rs index b2eb0fd3..4fdbcab1 100644 --- a/src/structs/cells.rs +++ b/src/structs/cells.rs @@ -1,9 +1,9 @@ use super::Cell; use super::CellValue; use super::Style; -use hashbrown::HashMap; use helper::coordinate::*; use helper::range::*; +use std::collections::HashMap; use structs::Column; use structs::Row; use traits::AdjustmentCoordinate; @@ -194,7 +194,7 @@ impl Cells { let col_num = cell.get_coordinate().get_col_num(); let row_num = cell.get_coordinate().get_row_num(); let k = (row_num.to_owned(), col_num.to_owned()); - self.map.insert_unique_unchecked(k, Box::new(cell)); + self.map.insert(k, Box::new(cell)); } #[inline] diff --git a/src/structs/drawing/list_style.rs b/src/structs/drawing/list_style.rs index aa9f0ea8..3ebcd732 100644 --- a/src/structs/drawing/list_style.rs +++ b/src/structs/drawing/list_style.rs @@ -1,11 +1,11 @@ // a:lstStyle use super::EffectList; use super::TextParagraphPropertiesType; -use hashbrown::HashMap; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; use reader::driver::*; +use std::collections::HashMap; use std::io::Cursor; use writer::driver::*; diff --git a/src/structs/numbering_format.rs b/src/structs/numbering_format.rs index 1f690fdb..29bf45df 100644 --- a/src/structs/numbering_format.rs +++ b/src/structs/numbering_format.rs @@ -1,10 +1,10 @@ -use hashbrown::HashMap; use md5::Digest; use quick_xml::escape; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; use reader::driver::*; +use std::collections::HashMap; use std::io::Cursor; use writer::driver::*; diff --git a/src/structs/numbering_formats.rs b/src/structs/numbering_formats.rs index 7e2971f5..25f20866 100644 --- a/src/structs/numbering_formats.rs +++ b/src/structs/numbering_formats.rs @@ -1,11 +1,11 @@ // numFmts use super::NumberingFormat; use super::Style; -use hashbrown::HashMap; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; use reader::driver::*; +use std::collections::HashMap; use std::io::Cursor; use writer::driver::*; diff --git a/src/structs/row.rs b/src/structs/row.rs index 619a78bc..9ed01ab0 100644 --- a/src/structs/row.rs +++ b/src/structs/row.rs @@ -6,12 +6,12 @@ use super::SharedStringTable; use super::Style; use super::Stylesheet; use super::UInt32Value; -use hashbrown::HashMap; use helper::formula::*; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; use reader::driver::*; +use std::collections::HashMap; use std::io::Cursor; use traits::AdjustmentValue; use writer::driver::*; diff --git a/src/structs/rows.rs b/src/structs/rows.rs index b27d21ed..c0a9acd4 100644 --- a/src/structs/rows.rs +++ b/src/structs/rows.rs @@ -1,4 +1,4 @@ -use hashbrown::HashMap; +use std::collections::HashMap; use structs::Row; use traits::AdjustmentValue; diff --git a/src/structs/shared_string_table.rs b/src/structs/shared_string_table.rs index fb20ac9d..3c51fb21 100644 --- a/src/structs/shared_string_table.rs +++ b/src/structs/shared_string_table.rs @@ -3,12 +3,12 @@ use super::drawing::Theme; use super::CellValue; use super::SharedStringItem; use drawing::charts::View3D; -use hashbrown::HashMap; use helper::const_str::*; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; use reader::driver::*; +use std::collections::HashMap; use std::io::Cursor; use thin_vec::ThinVec; use writer::driver::*; diff --git a/src/structs/worksheet.rs b/src/structs/worksheet.rs index 6d6422c4..61700a27 100644 --- a/src/structs/worksheet.rs +++ b/src/structs/worksheet.rs @@ -1,10 +1,10 @@ use crate::traits; use crate::StringValue; -use hashbrown::HashMap; use helper::const_str::*; use helper::coordinate::*; use helper::range::*; use reader::xlsx::worksheet::*; +use std::collections::HashMap; use structs::drawing::spreadsheet::WorksheetDrawing; use structs::office2010::excel::DataValidations as DataValidations2010; use structs::raw::RawWorksheet; diff --git a/src/structs/writer_manager.rs b/src/structs/writer_manager.rs index cc28c7a8..b85608f4 100644 --- a/src/structs/writer_manager.rs +++ b/src/structs/writer_manager.rs @@ -5,16 +5,16 @@ use std::io::Cursor; use structs::Spreadsheet; use structs::XlsxError; use writer::driver::*; -pub struct WriterManager { +pub struct WriterManager<'a, W: io::Seek + io::Write> { files: Vec, - arv: zip::ZipWriter, + arv: &'a mut zip::ZipWriter, is_light: bool, table_no: i32, } -impl WriterManager { +impl<'a, W: io::Seek + io::Write> WriterManager<'a, W> { #[inline] - pub fn new(arv: zip::ZipWriter) -> Self { + pub fn new(arv: &'a mut zip::ZipWriter) -> Self { WriterManager { files: Vec::new(), arv, @@ -52,7 +52,7 @@ impl WriterManager { writer: Writer>>, ) -> Result<(), XlsxError> { if !self.check_file_exist(target) { - make_file_from_writer(target, &mut self.arv, writer, None, &self.is_light)?; + make_file_from_writer(target, self.arv, writer, None, &self.is_light)?; self.files.push(target.to_string()); } Ok(()) diff --git a/src/writer/xlsx.rs b/src/writer/xlsx.rs index ac915cae..a5ba2cde 100644 --- a/src/writer/xlsx.rs +++ b/src/writer/xlsx.rs @@ -6,6 +6,7 @@ use std::fs; use std::fs::File; use std::io; use std::io::Read; +use std::io::Write; use std::path::Path; use std::string::FromUtf8Error; use structs::Spreadsheet; @@ -36,8 +37,8 @@ mod worksheet; mod worksheet_rels; fn make_buffer(spreadsheet: &Spreadsheet, is_light: bool) -> Result, XlsxError> { - let arv = zip::ZipWriter::new(std::io::Cursor::new(Vec::new())); - let mut writer_manager = WriterManager::new(arv); + let mut arv = zip::ZipWriter::new(std::io::Cursor::new(Vec::new())); + let mut writer_manager = WriterManager::new(&mut arv); writer_manager.set_is_light(is_light); // Add docProps App @@ -170,8 +171,7 @@ fn make_buffer(spreadsheet: &Spreadsheet, is_light: bool) -> Result