Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
mxsrm committed Dec 31, 2024
1 parent 80d99ec commit b54a83c
Show file tree
Hide file tree
Showing 63 changed files with 151 additions and 130 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ byteorder = "1.5"
cbc = "0.1.2"
cfb = "0.10.0"
chrono = { version = "0.4.39", default-features = false, features = ["clock"] }
ecow = "0.2.3"
encoding_rs = "0.8.35"
fancy-regex = "0.14.0"
hmac = "0.12.1"
Expand Down
21 changes: 11 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,32 +214,33 @@
clippy::too_many_lines
)]

extern crate chrono;
extern crate fancy_regex;
#[cfg(feature = "image")]
extern crate image;
extern crate md5;
extern crate quick_xml;
extern crate thousands;
extern crate zip;

extern crate aes;
extern crate base64;
extern crate byteorder;
extern crate cbc;
extern crate cfb;
extern crate chrono;
extern crate ecow;
extern crate fancy_regex;
extern crate hmac;
extern crate html_parser;
extern crate md5;
extern crate quick_xml;
extern crate rand;
extern crate sha2;
extern crate thousands;
extern crate zip;

#[cfg(feature = "image")]
extern crate image;

pub mod helper;
pub mod reader;
pub mod structs;
pub mod traits;
mod version;
pub mod writer;

mod version;
#[allow(unused_imports)]
pub use version::*;

Expand Down
7 changes: 4 additions & 3 deletions src/structs/borders_crate.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// borders
use std::io::Cursor;

use ecow::EcoVec;
use quick_xml::{
Reader,
Writer,
Expand All @@ -24,7 +25,7 @@ use crate::{

#[derive(Clone, Default, Debug)]
pub(crate) struct BordersCrate {
borders: Vec<Borders>,
borders: EcoVec<Borders>,
}

impl BordersCrate {
Expand All @@ -35,8 +36,8 @@ impl BordersCrate {

#[inline]
#[allow(dead_code)]
pub(crate) fn get_borders_mut(&mut self) -> &mut Vec<Borders> {
&mut self.borders
pub(crate) fn get_borders_mut(&mut self) -> &mut [Borders] {
self.borders.make_mut()
}

#[inline]
Expand Down
8 changes: 4 additions & 4 deletions src/structs/cache_fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ use crate::{

#[derive(Clone, Default, Debug)]
pub struct CacheFields {
list: Vec<CacheField>,
list: ecow::EcoVec<CacheField>,
}
impl CacheFields {
#[must_use]
pub fn get_list(&self) -> &Vec<CacheField> {
pub fn get_list(&self) -> &[CacheField] {
&self.list
}

pub fn get_list_mut(&mut self) -> &mut Vec<CacheField> {
&mut self.list
pub fn get_list_mut(&mut self) -> &mut [CacheField] {
self.list.make_mut()
}

pub fn add_list_mut(&mut self, value: CacheField) -> &mut Self {
Expand Down
2 changes: 1 addition & 1 deletion src/structs/cell_formats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl CellFormats {
}

#[inline]
pub(crate) fn get_cell_format_mut(&mut self) -> &mut Vec<CellFormat> {
pub(crate) fn get_cell_format_mut(&mut self) -> &mut [CellFormat] {
&mut self.cell_format
}

Expand Down
7 changes: 4 additions & 3 deletions src/structs/cell_style_formats.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// cellStyleXfs
use std::io::Cursor;

use ecow::EcoVec;
use quick_xml::{
Reader,
Writer,
Expand All @@ -21,7 +22,7 @@ use crate::{

#[derive(Clone, Default, Debug)]
pub(crate) struct CellStyleFormats {
cell_format: Vec<CellFormat>,
cell_format: EcoVec<CellFormat>,
}

impl CellStyleFormats {
Expand All @@ -31,8 +32,8 @@ impl CellStyleFormats {
}

#[inline]
pub(crate) fn get_cell_format_mut(&mut self) -> &mut Vec<CellFormat> {
&mut self.cell_format
pub(crate) fn get_cell_format_mut(&mut self) -> &mut [CellFormat] {
self.cell_format.make_mut()
}

#[inline]
Expand Down
7 changes: 4 additions & 3 deletions src/structs/cell_styles.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// cellStyles
use std::io::Cursor;

use ecow::EcoVec;
use quick_xml::{
Reader,
Writer,
Expand All @@ -21,7 +22,7 @@ use crate::{

#[derive(Clone, Default, Debug)]
pub struct CellStyles {
cell_style: Vec<CellStyle>,
cell_style: EcoVec<CellStyle>,
}

impl CellStyles {
Expand All @@ -31,8 +32,8 @@ impl CellStyles {
}

#[inline]
pub fn get_cell_style_mut(&mut self) -> &mut Vec<CellStyle> {
&mut self.cell_style
pub fn get_cell_style_mut(&mut self) -> &mut [CellStyle] {
self.cell_style.make_mut()
}

#[inline]
Expand Down
11 changes: 6 additions & 5 deletions src/structs/color_scale.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::io::Cursor;

use ecow::EcoVec;
use quick_xml::{
Reader,
Writer,
Expand All @@ -23,8 +24,8 @@ use crate::{

#[derive(Clone, Default, Debug)]
pub struct ColorScale {
cfvo_collection: Vec<ConditionalFormatValueObject>,
color_collection: Vec<Color>,
cfvo_collection: EcoVec<ConditionalFormatValueObject>,
color_collection: EcoVec<Color>,
}

impl ColorScale {
Expand All @@ -35,8 +36,8 @@ impl ColorScale {
}

#[inline]
pub fn set_cfvo_collection(&mut self, value: Vec<ConditionalFormatValueObject>) -> &mut Self {
self.cfvo_collection = value;
pub fn set_cfvo_collection(&mut self, value: &[ConditionalFormatValueObject]) -> &mut Self {
self.cfvo_collection.make_mut().clone_from_slice(value);
self
}

Expand All @@ -54,7 +55,7 @@ impl ColorScale {

#[inline]
pub fn set_color_collection(&mut self, value: impl Into<Vec<Color>>) -> &mut Self {
self.color_collection = value.into();
self.color_collection = EcoVec::from(value.into());
self
}

Expand Down
2 changes: 1 addition & 1 deletion src/structs/column_breaks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl ColumnBreaks {
}

#[inline]
pub fn get_break_list_mut(&mut self) -> &mut Vec<Break> {
pub fn get_break_list_mut(&mut self) -> &mut [Break] {
&mut self.break_list
}

Expand Down
2 changes: 1 addition & 1 deletion src/structs/column_fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl ColumnFields {
}

#[inline]
pub fn get_list_mut(&mut self) -> &mut Vec<Field> {
pub fn get_list_mut(&mut self) -> &mut [Field] {
&mut self.list
}

Expand Down
2 changes: 1 addition & 1 deletion src/structs/column_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl ColumnItems {
}

#[inline]
pub fn get_list_mut(&mut self) -> &mut Vec<RowItem> {
pub fn get_list_mut(&mut self) -> &mut [RowItem] {
&mut self.list
}

Expand Down
16 changes: 9 additions & 7 deletions src/structs/columns.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// fills
use std::io::Cursor;

use ecow::EcoVec;
use quick_xml::{
Reader,
Writer,
Expand Down Expand Up @@ -30,7 +31,7 @@ use crate::{

#[derive(Clone, Default, Debug)]
pub(crate) struct Columns {
column: Vec<Column>,
column: EcoVec<Column>,
}

impl Columns {
Expand All @@ -40,8 +41,8 @@ impl Columns {
}

#[inline]
pub(crate) fn get_column_collection_mut(&mut self) -> &mut Vec<Column> {
&mut self.column
pub(crate) fn get_column_collection_mut(&mut self) -> &mut [Column] {
self.column.make_mut()
}

#[inline]
Expand Down Expand Up @@ -130,7 +131,8 @@ impl Columns {
// col

let mut column_copy = self.column.clone();
column_copy.sort_by_key(Column::get_col_num);
column_copy.make_mut().sort_by_key(Column::get_col_num);

let mut column_iter = column_copy.iter();
let mut column_raw = column_iter.next();
let mut obj = column_raw.unwrap();
Expand Down Expand Up @@ -193,15 +195,15 @@ impl Columns {
}
impl AdjustmentValue for Columns {
fn adjustment_insert_value(&mut self, root_num: u32, offset_num: u32) {
for column_dimension in &mut self.column {
for column_dimension in self.column.make_mut() {
column_dimension.adjustment_insert_value(root_num, offset_num);
}
}

fn adjustment_remove_value(&mut self, root_num: u32, offset_num: u32) {
self.get_column_collection_mut()
self.column
.retain(|x| !(x.is_remove_value(root_num, offset_num)));
for column_dimension in &mut self.column {
for column_dimension in self.column.make_mut() {
column_dimension.adjustment_remove_value(root_num, offset_num);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/structs/conditional_formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl ConditionalFormatting {
}

#[inline]
pub fn get_conditional_collection_mut(&mut self) -> &mut Vec<ConditionalFormattingRule> {
pub fn get_conditional_collection_mut(&mut self) -> &mut [ConditionalFormattingRule] {
&mut self.conditional_collection
}

Expand Down
2 changes: 1 addition & 1 deletion src/structs/custom_properties/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Properties {
}

#[inline]
pub fn get_custom_document_property_list_mut(&mut self) -> &mut Vec<CustomDocumentProperty> {
pub fn get_custom_document_property_list_mut(&mut self) -> &mut [CustomDocumentProperty] {
&mut self.custom_document_property_list
}

Expand Down
7 changes: 4 additions & 3 deletions src/structs/data_fields.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// dataFields
use std::io::Cursor;

use ecow::EcoVec;
use quick_xml::{
Reader,
Writer,
Expand All @@ -21,7 +22,7 @@ use crate::{

#[derive(Clone, Default, Debug)]
pub struct DataFields {
list: Vec<DataField>,
list: EcoVec<DataField>,
}
impl DataFields {
#[inline]
Expand All @@ -31,8 +32,8 @@ impl DataFields {
}

#[inline]
pub fn get_list_mut(&mut self) -> &mut Vec<DataField> {
&mut self.list
pub fn get_list_mut(&mut self) -> &mut [DataField] {
self.list.make_mut()
}

#[inline]
Expand Down
9 changes: 5 additions & 4 deletions src/structs/data_validations.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// dataValidations
use std::io::Cursor;

use ecow::EcoVec;
use quick_xml::{
Reader,
Writer,
Expand All @@ -21,7 +22,7 @@ use crate::{

#[derive(Default, Debug, Clone)]
pub struct DataValidations {
data_validation_list: Vec<DataValidation>,
data_validation_list: EcoVec<DataValidation>,
}

impl DataValidations {
Expand All @@ -32,13 +33,13 @@ impl DataValidations {
}

#[inline]
pub fn get_data_validation_list_mut(&mut self) -> &mut Vec<DataValidation> {
&mut self.data_validation_list
pub fn get_data_validation_list_mut(&mut self) -> &mut [DataValidation] {
self.data_validation_list.make_mut()
}

#[inline]
pub fn set_data_validation_list(&mut self, value: impl Into<Vec<DataValidation>>) -> &mut Self {
self.data_validation_list = value.into();
self.data_validation_list = EcoVec::from(value.into());
self
}

Expand Down
2 changes: 1 addition & 1 deletion src/structs/defined_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl DefinedName {

#[inline]
#[allow(dead_code)]
pub(crate) fn get_address_obj_mut(&mut self) -> &mut Vec<Address> {
pub(crate) fn get_address_obj_mut(&mut self) -> &mut [Address] {
&mut self.address
}

Expand Down
Loading

0 comments on commit b54a83c

Please sign in to comment.