diff --git a/src/helper/color.rs b/src/helper/color.rs index f37f94d3..eb670fa0 100644 --- a/src/helper/color.rs +++ b/src/helper/color.rs @@ -47,6 +47,7 @@ pub fn split_rgb(rgb: &str) -> (i32, i32, i32) { (r, g, b) } +#[inline] pub fn join_rgb(r: &i32, g: &i32, b: &i32) -> String { format!("{:02X}{:02X}{:02X}", r, g, b) } @@ -174,6 +175,7 @@ pub fn set_color(t1: &f64, t2: &f64, t3: &f64) -> f64 { color } +#[inline] fn positive_decimal_part(hue: &f64) -> f64 { let hue = hue % 1.0; @@ -183,6 +185,7 @@ fn positive_decimal_part(hue: &f64) -> f64 { 1.0 + hue } +#[inline] fn to_i32(num: f64) -> i32 { num.round() as i32 } diff --git a/src/helper/coordinate.rs b/src/helper/coordinate.rs index c4a661c9..33a4496b 100644 --- a/src/helper/coordinate.rs +++ b/src/helper/coordinate.rs @@ -42,6 +42,7 @@ where .sum::() } +#[inline] pub fn column_index_from_string>(column: S) -> u32 { let column_c = column.as_ref(); if column_c == "0" { @@ -51,6 +52,7 @@ pub fn column_index_from_string>(column: S) -> u32 { alpha_to_index(column_c) } +#[inline] pub fn string_from_column_index(column_index: &u32) -> String { assert!(column_index >= &1u32, "Column number starts from 1."); @@ -91,6 +93,7 @@ where .unwrap_or_default() } +#[inline] pub fn coordinate_from_index(col: &u32, row: &u32) -> String { format!("{}{}", string_from_column_index(col), row) } @@ -110,6 +113,7 @@ pub fn coordinate_from_index_with_lock( ) } +#[inline] pub(crate) fn adjustment_insert_coordinate(num: &u32, root_num: &u32, offset_num: &u32) -> u32 { if (num >= root_num && offset_num != &0) { num + offset_num @@ -118,6 +122,7 @@ pub(crate) fn adjustment_insert_coordinate(num: &u32, root_num: &u32, offset_num } } +#[inline] pub(crate) fn adjustment_remove_coordinate(num: &u32, root_num: &u32, offset_num: &u32) -> u32 { if (num >= root_num && offset_num != &0) { num - offset_num @@ -126,6 +131,7 @@ pub(crate) fn adjustment_remove_coordinate(num: &u32, root_num: &u32, offset_num } } +#[inline] pub(crate) fn is_remove_coordinate(num: &u32, root_num: &u32, offset_num: &u32) -> bool { if root_num != &0 && offset_num != &0 { return num >= root_num && num < &(root_num + offset_num); @@ -143,24 +149,28 @@ pub struct CellCoordinates { } impl CellCoordinates { + #[inline] fn new(col: u32, row: u32) -> Self { CellCoordinates { row, col } } } impl From<(u32, u32)> for CellCoordinates { + #[inline] fn from(value: (u32, u32)) -> Self { CellCoordinates::new(value.0, value.1) } } impl From<(&u32, &u32)> for CellCoordinates { + #[inline] fn from(value: (&u32, &u32)) -> Self { CellCoordinates::new(*value.0, *value.1) } } impl From for CellCoordinates { + #[inline] fn from(value: String) -> Self { let str_ref: &str = value.as_ref(); str_ref.into() @@ -168,6 +178,7 @@ impl From for CellCoordinates { } impl From<&str> for CellCoordinates { + #[inline] fn from(value: &str) -> Self { let (col, row, ..) = index_from_coordinate(value.to_uppercase()); CellCoordinates::new(col.unwrap(), row.unwrap()) diff --git a/src/helper/crypt.rs b/src/helper/crypt.rs index c3022e63..07a84090 100644 --- a/src/helper/crypt.rs +++ b/src/helper/crypt.rs @@ -477,18 +477,21 @@ fn hash(algorithm: &str, buffers: Vec<&[u8]>) -> Result, String> { Ok(digest.finalize().to_vec()) } +#[inline] fn gen_random_16() -> Vec { let buf: &mut [u8] = &mut [0; 16]; getrandom::getrandom(buf); buf.to_vec() } +#[inline] fn gen_random_32() -> Vec { let buf: &mut [u8] = &mut [0; 32]; getrandom::getrandom(buf); buf.to_vec() } +#[inline] fn gen_random_64() -> Vec { let buf: &mut [u8] = &mut [0; 64]; getrandom::getrandom(buf); @@ -496,6 +499,7 @@ fn gen_random_64() -> Vec { } // Create a buffer of an integer encoded as a uint32le +#[inline] fn create_uint32_le_buffer(value: &u32, buffer_size: Option<&usize>) -> Vec { let bs_prm = buffer_size.unwrap_or(&4); let mut buffer = buffer_alloc(0, *bs_prm); @@ -631,10 +635,12 @@ fn build_encryption_info( buffer_concat(vec![&ENCRYPTION_INFO_PREFIX.to_vec(), &result]) } +#[inline] fn buffer_slice(buffer: &[u8], start: usize, end: usize) -> Vec { buffer[start..end].to_vec() } +#[inline] fn buffer_alloc(alloc_char: u8, size: usize) -> Vec { vec![alloc_char; size] } @@ -652,10 +658,12 @@ fn buffer_copy(buffer1: &mut [u8], buffer2: &[u8]) { } } +#[inline] fn buffer_read_u_int32_le(buffer: &[u8], _cnt: &usize) -> u32 { LittleEndian::read_u32(buffer) } +#[inline] fn buffer_write_u_int32_le(buffer: &mut [u8], value: &u32, _cnt: &usize) { LittleEndian::write_u32(buffer, *value); } diff --git a/src/helper/date.rs b/src/helper/date.rs index e34fc612..049f4767 100644 --- a/src/helper/date.rs +++ b/src/helper/date.rs @@ -39,10 +39,12 @@ pub fn excel_to_date_time_object( + Duration::seconds(seconds as i64) } +#[inline] fn get_default_timezone() -> String { String::from("UTC") } +#[inline] pub fn convert_date( year: i32, month: i32, @@ -54,6 +56,7 @@ pub fn convert_date( convert_date_windows_1900(year, month, day, hours, minutes, seconds) } +#[inline] pub fn convert_date_windows_1900( year: i32, month: i32, @@ -65,6 +68,7 @@ pub fn convert_date_windows_1900( convert_date_crate(year, month, day, hours, minutes, seconds, true) } +#[inline] pub fn convert_date_mac_1904( year: i32, month: i32, diff --git a/src/helper/formula.rs b/src/helper/formula.rs index f8462bf6..c749acdf 100644 --- a/src/helper/formula.rs +++ b/src/helper/formula.rs @@ -47,6 +47,7 @@ pub struct FormulaToken { token_sub_type: FormulaTokenSubTypes, } impl Default for FormulaToken { + #[inline] fn default() -> Self { Self { value: StringValue::default(), @@ -56,28 +57,34 @@ impl Default for FormulaToken { } } impl FormulaToken { + #[inline] pub fn get_value(&self) -> &str { self.value.get_value_str() } + #[inline] pub fn set_value>(&mut self, value: S) -> &mut Self { self.value.set_value(value); self } + #[inline] pub fn get_token_type(&self) -> &FormulaTokenTypes { &self.token_type } + #[inline] pub fn set_token_type(&mut self, value: FormulaTokenTypes) -> &mut Self { self.token_type = value; self } + #[inline] pub fn get_token_sub_type(&self) -> &FormulaTokenSubTypes { &self.token_sub_type } + #[inline] pub fn set_token_sub_type(&mut self, value: FormulaTokenSubTypes) -> &mut Self { self.token_sub_type = value; self diff --git a/src/helper/html.rs b/src/helper/html.rs index 0edcba27..ad09b810 100644 --- a/src/helper/html.rs +++ b/src/helper/html.rs @@ -29,6 +29,7 @@ use thin_vec::ThinVec; /// .get_alignment_mut() /// .set_wrap_text(true); /// ``` +#[inline] pub fn html_to_richtext(html: &str) -> Result { html_to_richtext_custom(html, &DataAnalysis::default()) } @@ -39,6 +40,7 @@ pub fn html_to_richtext(html: &str) -> Result { /// * `method` - struct for analysis. /// # Return value /// * `Result` +#[inline] pub fn html_to_richtext_custom( html: &str, method: &AnalysisMethod, @@ -181,10 +183,12 @@ pub struct HfdElement { classes: ThinVec, } impl HfdElement { + #[inline] pub fn has_name(&self, name: &str) -> bool { self.name == name } + #[inline] pub fn get_by_name_and_attribute(&self, name: &str, attribute: &str) -> Option<&str> { self.attributes .get(attribute) @@ -192,6 +196,7 @@ impl HfdElement { .map(|x| x.as_str()) } + #[inline] pub fn contains_class(&self, class: &str) -> bool { self.classes.contains(&class.to_string()) } @@ -213,6 +218,7 @@ pub trait AnalysisMethod { #[derive(Clone, Default, Debug)] struct DataAnalysis {} impl AnalysisMethod for DataAnalysis { + #[inline] fn font_name<'a>(&'a self, html_flat_data: &'a HtmlFlatData) -> Option<&str> { html_flat_data .element @@ -220,6 +226,7 @@ impl AnalysisMethod for DataAnalysis { .find_map(|element| element.get_by_name_and_attribute("font", "face")) } + #[inline] fn size(&self, html_flat_data: &HtmlFlatData) -> Option { html_flat_data.element.iter().find_map(|element| { element @@ -245,6 +252,7 @@ impl AnalysisMethod for DataAnalysis { }) } + #[inline] fn is_tag(&self, html_flat_data: &HtmlFlatData, tag: &str) -> bool { html_flat_data .element @@ -252,26 +260,32 @@ impl AnalysisMethod for DataAnalysis { .any(|element| element.has_name(tag)) } + #[inline] fn is_bold(&self, html_flat_data: &HtmlFlatData) -> bool { self.is_tag(html_flat_data, "b") || self.is_tag(html_flat_data, "strong") } + #[inline] fn is_italic(&self, html_flat_data: &HtmlFlatData) -> bool { self.is_tag(html_flat_data, "i") || self.is_tag(html_flat_data, "em") } + #[inline] fn is_underline(&self, html_flat_data: &HtmlFlatData) -> bool { self.is_tag(html_flat_data, "u") || self.is_tag(html_flat_data, "ins") } + #[inline] fn is_superscript(&self, html_flat_data: &HtmlFlatData) -> bool { self.is_tag(html_flat_data, "sup") } + #[inline] fn is_subscript(&self, html_flat_data: &HtmlFlatData) -> bool { self.is_tag(html_flat_data, "sub") } + #[inline] fn is_strikethrough(&self, html_flat_data: &HtmlFlatData) -> bool { self.is_tag(html_flat_data, "del") } diff --git a/src/helper/number_format.rs b/src/helper/number_format.rs index 1f27bb12..7ce69042 100644 --- a/src/helper/number_format.rs +++ b/src/helper/number_format.rs @@ -18,6 +18,7 @@ pub struct Split<'r, 't> { last: usize, } +#[inline] pub fn split<'r, 't>(regex: &'r Regex, text: &'t str) -> Split<'r, 't> { Split { finder: regex.find_iter(text), diff --git a/src/helper/number_format/fraction_formater.rs b/src/helper/number_format/fraction_formater.rs index fbb98792..63387641 100644 --- a/src/helper/number_format/fraction_formater.rs +++ b/src/helper/number_format/fraction_formater.rs @@ -69,6 +69,7 @@ pub(crate) fn format_as_fraction(value: &f64, format: &str) -> String { result } +#[inline] fn gcd(a: &f64, b: &f64) -> f64 { if b == &0f64 { *a diff --git a/src/helper/range.rs b/src/helper/range.rs index 34f0e25e..819a2cc0 100644 --- a/src/helper/range.rs +++ b/src/helper/range.rs @@ -66,10 +66,12 @@ pub fn get_start_and_end_point(range_str: &str) -> (u32, u32, u32, u32) { (row_start, row_end, col_start, col_end) } +#[inline] pub fn get_split_range(range: &str) -> Vec<&str> { range.split(':').collect() } +#[inline] pub fn get_join_range(coordinate_list: &[String]) -> String { coordinate_list.join(":") } diff --git a/src/helper/string_helper.rs b/src/helper/string_helper.rs index ae41aef9..f35830f8 100644 --- a/src/helper/string_helper.rs +++ b/src/helper/string_helper.rs @@ -1,11 +1,14 @@ +#[inline] pub(crate) fn _get_currency_code() -> String { String::from("") } +#[inline] pub(crate) fn _get_decimal_separator() -> String { String::from(".") } +#[inline] pub(crate) fn _get_thousands_separator() -> String { String::from(",") } diff --git a/src/helper/utils.rs b/src/helper/utils.rs index a1f7c76c..f31cb943 100644 --- a/src/helper/utils.rs +++ b/src/helper/utils.rs @@ -2,6 +2,7 @@ macro_rules! from_err { ($from:ty, $to:tt, $var:tt) => { impl From<$from> for $to { + #[inline] fn from(e: $from) -> $to { $to::$var(e) } diff --git a/src/reader/driver.rs b/src/reader/driver.rs index 5d36d2bf..f87a3f0a 100644 --- a/src/reader/driver.rs +++ b/src/reader/driver.rs @@ -63,6 +63,7 @@ pub(crate) fn normalize_path(path: &str) -> PathBuf { ret } +#[inline] pub(crate) fn join_paths(base_path: &str, target: &str) -> String { match target.split_once('/') { Some(("", target)) => normalize_path_to_str(target), @@ -70,11 +71,13 @@ pub(crate) fn join_paths(base_path: &str, target: &str) -> String { } } +#[inline] pub(crate) fn normalize_path_to_str(path: &str) -> String { let ret = normalize_path(path); ret.to_str().unwrap_or("").replace('\\', "/") } +#[inline] pub(crate) fn get_attribute(e: &quick_xml::events::BytesStart<'_>, key: &[u8]) -> Option { e.attributes() .with_checks(false) @@ -85,6 +88,8 @@ pub(crate) fn get_attribute(e: &quick_xml::events::BytesStart<'_>, key: &[u8]) - _ => None, }) } + +#[inline] pub(crate) fn get_attribute_value(attr: &Attribute) -> Result { String::from_utf8(attr.value.to_vec()) } diff --git a/src/reader/xlsx.rs b/src/reader/xlsx.rs index 3083e51a..af1f657f 100644 --- a/src/reader/xlsx.rs +++ b/src/reader/xlsx.rs @@ -92,6 +92,7 @@ pub fn read_reader( /// let path = std::path::Path::new("./tests/test_files/aaa.xlsx"); /// let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); /// ``` +#[inline] pub fn read>(path: P) -> Result { let file = File::open(path)?; read_reader(file, true) @@ -109,6 +110,7 @@ pub fn read>(path: P) -> Result { /// let path = std::path::Path::new("./tests/test_files/aaa.xlsx"); /// let mut book = umya_spreadsheet::reader::xlsx::lazy_read(path).unwrap(); /// ``` +#[inline] pub fn lazy_read(path: &Path) -> Result { let file = File::open(path)?; read_reader(file, false) diff --git a/src/structs/address.rs b/src/structs/address.rs index 3a46b9c9..95b8293d 100644 --- a/src/structs/address.rs +++ b/src/structs/address.rs @@ -12,23 +12,28 @@ pub struct Address { } impl Address { + #[inline] pub fn get_sheet_name(&self) -> &str { &self.sheet_name } + #[inline] pub fn set_sheet_name>(&mut self, value: S) -> &mut Self { self.sheet_name = value.into().into_boxed_str(); self } + #[inline] pub fn get_range(&self) -> &Range { &self.range } + #[inline] pub fn get_range_mut(&mut self) -> &mut Range { &mut self.range } + #[inline] pub fn set_range(&mut self, value: Range) -> &mut Self { self.range = value; self @@ -44,10 +49,12 @@ impl Address { self } + #[inline] pub fn get_address(&self) -> String { self.get_address_crate(false) } + #[inline] pub(crate) fn get_address_ptn2(&self) -> String { self.get_address_crate(true) } @@ -94,6 +101,7 @@ impl Address { } } impl AdjustmentCoordinateWithSheet for Address { + #[inline] fn adjustment_insert_coordinate_with_sheet( &mut self, sheet_name: &str, @@ -112,6 +120,7 @@ impl AdjustmentCoordinateWithSheet for Address { } } + #[inline] fn adjustment_remove_coordinate_with_sheet( &mut self, sheet_name: &str, @@ -130,6 +139,7 @@ impl AdjustmentCoordinateWithSheet for Address { } } + #[inline] fn is_remove_coordinate_with_sheet( &self, sheet_name: &str, diff --git a/src/structs/alignment.rs b/src/structs/alignment.rs index 73a966d2..f7ddc737 100644 --- a/src/structs/alignment.rs +++ b/src/structs/alignment.rs @@ -21,34 +21,42 @@ pub struct Alignment { } impl Alignment { + #[inline] pub fn get_horizontal(&self) -> &HorizontalAlignmentValues { self.horizontal.get_value() } + #[inline] pub fn set_horizontal(&mut self, value: HorizontalAlignmentValues) { self.horizontal.set_value(value); } + #[inline] pub fn get_vertical(&self) -> &VerticalAlignmentValues { self.vertical.get_value() } + #[inline] pub fn set_vertical(&mut self, value: VerticalAlignmentValues) { self.vertical.set_value(value); } + #[inline] pub fn get_wrap_text(&self) -> &bool { self.wrap_text.get_value() } + #[inline] pub fn set_wrap_text(&mut self, value: bool) { self.wrap_text.set_value(value); } + #[inline] pub fn get_text_rotation(&self) -> &u32 { self.text_rotation.get_value() } + #[inline] pub fn set_text_rotation(&mut self, value: u32) { self.text_rotation.set_value(value); } @@ -66,6 +74,7 @@ impl Alignment { ) } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, diff --git a/src/structs/anchor.rs b/src/structs/anchor.rs index befbfabd..1ee0c426 100644 --- a/src/structs/anchor.rs +++ b/src/structs/anchor.rs @@ -11,85 +11,105 @@ pub struct Anchor { } impl Anchor { + #[inline] pub fn get_left_column(&self) -> &u32 { &self.left_column } + #[inline] pub fn set_left_column(&mut self, value: u32) { self.left_column = value; } + #[inline] pub fn get_left_offset(&self) -> &u32 { &self.left_offset } + #[inline] pub fn set_left_offset(&mut self, value: u32) { self.left_offset = value; } + #[inline] pub fn get_top_row(&self) -> &u32 { &self.top_row } + #[inline] pub fn set_top_row(&mut self, value: u32) { self.top_row = value; } + #[inline] pub fn get_top_offset(&self) -> &u32 { &self.top_offset } + #[inline] pub fn set_top_offset(&mut self, value: u32) { self.top_offset = value; } + #[inline] pub fn get_right_column(&self) -> &u32 { &self.right_column } + #[inline] pub fn set_right_column(&mut self, value: u32) { self.right_column = value; } + #[inline] pub fn get_right_offset(&self) -> &u32 { &self.right_offset } + #[inline] pub fn set_right_offset(&mut self, value: u32) { self.right_offset = value; } + #[inline] pub fn get_bottom_row(&self) -> &u32 { &self.bottom_row } + #[inline] pub fn set_bottom_row(&mut self, value: u32) { self.bottom_row = value; } + #[inline] pub fn get_bottom_offset(&self) -> &u32 { &self.bottom_offset } + #[inline] pub fn set_bottom_offset(&mut self, value: u32) { self.bottom_offset = value; } + #[inline] pub(crate) fn _adjustment_insert_row(&mut self, num_rows: &u32) { self.top_row += num_rows; self.bottom_row += num_rows; } + #[inline] pub(crate) fn _adjustment_insert_column(&mut self, num_cols: &u32) { self.left_column += num_cols; self.right_column += num_cols; } + #[inline] pub(crate) fn _adjustment_remove_row(&mut self, num_rows: &u32) { self.top_row = self.top_row.saturating_sub(*num_rows).max(1); self.bottom_row = self.bottom_row.saturating_sub(*num_rows).max(1); } + #[inline] pub(crate) fn _adjustment_remove_column(&mut self, num_cols: &u32) { self.left_column = self.left_column.saturating_sub(*num_cols).max(1); self.right_column = self.right_column.saturating_sub(*num_cols).max(1); diff --git a/src/structs/auto_filter.rs b/src/structs/auto_filter.rs index e3eb4e4a..bd265436 100644 --- a/src/structs/auto_filter.rs +++ b/src/structs/auto_filter.rs @@ -7,14 +7,17 @@ pub struct AutoFilter { } impl AutoFilter { + #[inline] pub fn get_range(&self) -> &Range { &self.range } + #[inline] pub fn get_range_mut(&mut self) -> &mut Range { &mut self.range } + #[inline] pub(crate) fn set_range>(&mut self, value: S) { let mut range = Range::default(); range.set_range(value.into()); @@ -22,6 +25,7 @@ impl AutoFilter { } } impl AdjustmentCoordinate for AutoFilter { + #[inline] fn adjustment_insert_coordinate( &mut self, root_col_num: &u32, @@ -37,6 +41,7 @@ impl AdjustmentCoordinate for AutoFilter { ); } + #[inline] fn adjustment_remove_coordinate( &mut self, root_col_num: &u32, diff --git a/src/structs/bold.rs b/src/structs/bold.rs index ffbfc178..fb96d668 100644 --- a/src/structs/bold.rs +++ b/src/structs/bold.rs @@ -13,15 +13,18 @@ pub struct Bold { } impl Bold { + #[inline] pub fn get_val(&self) -> &bool { self.val.get_value() } + #[inline] pub fn set_val(&mut self, value: bool) -> &mut Self { self.val.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -31,6 +34,7 @@ impl Bold { set_string_from_xml!(self, e, val, "val"); } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { // b if *self.val.get_value() { diff --git a/src/structs/boolean_value.rs b/src/structs/boolean_value.rs index daee9743..51bb0c2f 100644 --- a/src/structs/boolean_value.rs +++ b/src/structs/boolean_value.rs @@ -4,10 +4,12 @@ pub struct BooleanValue { } impl BooleanValue { + #[inline] pub(crate) fn get_value(&self) -> &bool { self.value.as_ref().unwrap_or(&false) } + #[inline] pub(crate) fn get_value_string(&self) -> &str { match *self.get_value() { true => "1", @@ -15,19 +17,23 @@ impl BooleanValue { } } + #[inline] pub(crate) fn set_value(&mut self, value: bool) -> &mut Self { self.value = Some(value); self } + #[inline] pub(crate) fn set_value_string>(&mut self, value: S) -> &mut Self { self.set_value(matches!(value.into().as_str(), "true" | "1")) } + #[inline] pub(crate) fn has_value(&self) -> bool { self.value.is_some() } + #[inline] pub(crate) fn get_hash_string(&self) -> &str { if self.has_value() { return self.get_value_string(); diff --git a/src/structs/border.rs b/src/structs/border.rs index 9b5c2feb..f7903bd1 100644 --- a/src/structs/border.rs +++ b/src/structs/border.rs @@ -17,23 +17,28 @@ pub struct Border { } impl Border { + #[inline] pub fn get_color(&self) -> &Color { &self.color } + #[inline] pub fn get_color_mut(&mut self) -> &mut Color { &mut self.color } + #[inline] pub fn set_color(&mut self, value: Color) -> &mut Self { self.color = value; self } + #[inline] pub fn get_style(&self) -> &BorderStyleValues { self.style.get_value() } + #[inline] pub fn set_style(&mut self, value: BorderStyleValues) -> &mut Self { self.style.set_value(value); self @@ -55,9 +60,11 @@ impl Border { pub const BORDER_THICK: &'static str = "thick"; pub const BORDER_THIN: &'static str = "thin"; + #[inline] pub fn get_border_style(&self) -> &str { self.style.get_value_string() } + #[inline] pub fn set_border_style>(&mut self, value: S) { self.style.set_value_string(value); } @@ -74,6 +81,7 @@ impl Border { } // When opened in software such as Excel, it is visually blank. + #[inline] pub(crate) fn is_visually_empty(&self) -> bool { self.style.get_value() == &BorderStyleValues::None } @@ -116,30 +124,37 @@ impl Border { ); } + #[inline] pub(crate) fn write_to_left(&self, writer: &mut Writer>>) { self.write_to(writer, "left"); } + #[inline] pub(crate) fn write_to_right(&self, writer: &mut Writer>>) { self.write_to(writer, "right"); } + #[inline] pub(crate) fn write_to_top(&self, writer: &mut Writer>>) { self.write_to(writer, "top"); } + #[inline] pub(crate) fn write_to_bottom(&self, writer: &mut Writer>>) { self.write_to(writer, "bottom"); } + #[inline] pub(crate) fn write_to_diagonal(&self, writer: &mut Writer>>) { self.write_to(writer, "diagonal"); } + #[inline] pub(crate) fn write_to_vertical(&self, writer: &mut Writer>>) { self.write_to(writer, "vertical"); } + #[inline] pub(crate) fn write_to_horizontal(&self, writer: &mut Writer>>) { self.write_to(writer, "horizontal"); } diff --git a/src/structs/border_style_values.rs b/src/structs/border_style_values.rs index 9c00d549..07b54fdb 100644 --- a/src/structs/border_style_values.rs +++ b/src/structs/border_style_values.rs @@ -18,11 +18,13 @@ pub enum BorderStyleValues { Thin, } impl Default for BorderStyleValues { + #[inline] fn default() -> Self { Self::None } } impl EnumTrait for BorderStyleValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::DashDot => "dashDot", @@ -44,6 +46,8 @@ impl EnumTrait for BorderStyleValues { } impl FromStr for BorderStyleValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "dashDot" => Ok(Self::DashDot), diff --git a/src/structs/borders.rs b/src/structs/borders.rs index 5424a358..6aa39fb6 100644 --- a/src/structs/borders.rs +++ b/src/structs/borders.rs @@ -39,182 +39,224 @@ impl Borders { pub const BORDER_THICK: &'static str = "thick"; pub const BORDER_THIN: &'static str = "thin"; + #[inline] pub fn get_left_border(&self) -> &Border { &self.left_border } + #[inline] pub fn get_left_border_mut(&mut self) -> &mut Border { &mut self.left_border } + #[inline] pub fn set_left_border(&mut self, value: Border) -> &mut Self { self.left_border = value; self } + #[inline] pub fn get_left(&self) -> &Border { &self.left_border } + #[inline] pub fn get_left_mut(&mut self) -> &mut Border { &mut self.left_border } + #[inline] pub fn set_left(&mut self, value: Border) -> &mut Self { self.left_border = value; self } + #[inline] pub fn get_right_border(&self) -> &Border { &self.right_border } + #[inline] pub fn get_right_border_mut(&mut self) -> &mut Border { &mut self.right_border } + #[inline] pub fn set_right_border(&mut self, value: Border) -> &mut Self { self.right_border = value; self } + #[inline] pub fn get_right(&self) -> &Border { &self.right_border } + #[inline] pub fn get_right_mut(&mut self) -> &mut Border { &mut self.right_border } + #[inline] pub fn set_right(&mut self, value: Border) -> &mut Self { self.right_border = value; self } + #[inline] pub fn get_top_border(&self) -> &Border { &self.top_border } + #[inline] pub fn get_top_border_mut(&mut self) -> &mut Border { &mut self.top_border } + #[inline] pub fn set_top_border(&mut self, value: Border) -> &mut Self { self.top_border = value; self } + #[inline] pub fn get_top(&self) -> &Border { &self.top_border } + #[inline] pub fn get_top_mut(&mut self) -> &mut Border { &mut self.top_border } + #[inline] pub fn set_top(&mut self, value: Border) -> &mut Self { self.top_border = value; self } + #[inline] pub fn get_bottom_border(&self) -> &Border { &self.bottom_border } + #[inline] pub fn get_bottom_border_mut(&mut self) -> &mut Border { &mut self.bottom_border } + #[inline] pub fn set_bottom_border(&mut self, value: Border) -> &mut Self { self.bottom_border = value; self } + #[inline] pub fn get_bottom(&self) -> &Border { &self.bottom_border } + #[inline] pub fn get_bottom_mut(&mut self) -> &mut Border { &mut self.bottom_border } + #[inline] pub fn set_bottom(&mut self, value: Border) -> &mut Self { self.bottom_border = value; self } + #[inline] pub fn get_diagonal_border(&self) -> &Border { &self.diagonal_border } + #[inline] pub fn get_diagonal_border_mut(&mut self) -> &mut Border { &mut self.diagonal_border } + #[inline] pub fn set_diagonal_border(&mut self, value: Border) -> &mut Self { self.diagonal_border = value; self } + #[inline] pub fn get_diagonal(&self) -> &Border { &self.diagonal_border } + #[inline] pub fn get_diagonal_mut(&mut self) -> &mut Border { &mut self.diagonal_border } + #[inline] pub fn set_diagonal(&mut self, value: Border) -> &mut Self { self.diagonal_border = value; self } + #[inline] pub fn get_vertical_border(&self) -> &Border { &self.vertical_border } + #[inline] pub fn get_vertical_border_mut(&mut self) -> &mut Border { &mut self.vertical_border } + #[inline] pub fn set_vertical_border(&mut self, value: Border) -> &mut Self { self.vertical_border = value; self } + #[inline] pub fn get_horizontal_border(&self) -> &Border { &self.horizontal_border } + #[inline] pub fn get_horizontal_border_mut(&mut self) -> &mut Border { &mut self.horizontal_border } + #[inline] pub fn set_horizontal_border(&mut self, value: Border) -> &mut Self { self.horizontal_border = value; self } + #[inline] pub fn get_diagonal_down(&self) -> &bool { self.diagonal_down.get_value() } + #[inline] pub fn set_diagonal_down(&mut self, value: bool) { self.diagonal_down.set_value(value); } + #[inline] pub fn get_diagonal_up(&self) -> &bool { self.diagonal_up.get_value() } + #[inline] pub fn set_diagonal_up(&mut self, value: bool) { self.diagonal_up.set_value(value); } + #[inline] pub(crate) fn get_default_value() -> Self { Self::default() } + #[inline] pub(crate) fn get_hash_code(&self) -> String { format!( "{:x}", @@ -234,6 +276,7 @@ impl Borders { } // When opened in software such as Excel, it is visually blank. + #[inline] pub(crate) fn is_visually_empty(&self) -> bool { self.left_border.is_visually_empty() || self.right_border.is_visually_empty() diff --git a/src/structs/borders_crate.rs b/src/structs/borders_crate.rs index 42bcf0f5..8167d8a9 100644 --- a/src/structs/borders_crate.rs +++ b/src/structs/borders_crate.rs @@ -15,14 +15,17 @@ pub(crate) struct BordersCrate { } impl BordersCrate { + #[inline] pub(crate) fn get_borders(&self) -> &[Borders] { &self.borders } + #[inline] pub(crate) fn get_borders_mut(&mut self) -> &mut ThinVec { &mut self.borders } + #[inline] pub(crate) fn set_borders(&mut self, value: Borders) -> &mut Self { self.borders.push(value); self diff --git a/src/structs/break.rs b/src/structs/break.rs index f51e3d8a..24bf1cb5 100644 --- a/src/structs/break.rs +++ b/src/structs/break.rs @@ -17,33 +17,40 @@ pub struct Break { } impl Break { + #[inline] pub fn get_id(&self) -> &u32 { self.id.get_value() } + #[inline] pub fn set_id(&mut self, value: u32) -> &mut Self { self.id.set_value(value); self } + #[inline] pub fn get_max(&self) -> &u32 { self.max.get_value() } + #[inline] pub fn set_max(&mut self, value: u32) -> &mut Self { self.max.set_value(value); self } + #[inline] pub fn get_manual_page_break(&self) -> &bool { self.manual_page_break.get_value() } + #[inline] pub fn set_manual_page_break(&mut self, value: bool) -> &mut Self { self.manual_page_break.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, diff --git a/src/structs/byte_value.rs b/src/structs/byte_value.rs index 8b6ecbee..86fd8ed6 100644 --- a/src/structs/byte_value.rs +++ b/src/structs/byte_value.rs @@ -3,6 +3,7 @@ pub struct ByteValue { value: Option, } impl ByteValue { + #[inline] pub(crate) fn get_value(&self) -> &u8 { match &self.value { Some(v) => v, @@ -10,19 +11,23 @@ impl ByteValue { } } + #[inline] pub(crate) fn get_value_string(&self) -> String { self.get_value().to_string() } + #[inline] pub(crate) fn set_value(&mut self, value: u8) -> &mut ByteValue { self.value = Some(value); self } + #[inline] pub(crate) fn set_value_string>(&mut self, value: S) -> &mut ByteValue { self.set_value(value.into().parse::().unwrap()) } + #[inline] pub(crate) fn has_value(&self) -> bool { self.value.is_some() } diff --git a/src/structs/cell.rs b/src/structs/cell.rs index 1d870bc4..21ca6375 100644 --- a/src/structs/cell.rs +++ b/src/structs/cell.rs @@ -35,36 +35,44 @@ pub struct Cell { cell_meta_index: UInt32Value, } impl Cell { + #[inline] pub fn get_cell_value(&self) -> &CellValue { &self.cell_value } + #[inline] pub fn get_cell_value_mut(&mut self) -> &mut CellValue { &mut self.cell_value } + #[inline] pub fn set_cell_value(&mut self, value: CellValue) -> &mut Self { self.cell_value = Box::new(value); self } + #[inline] pub fn get_style(&self) -> &Style { &self.style } + #[inline] pub fn get_style_mut(&mut self) -> &mut Style { &mut self.style } + #[inline] pub fn set_style(&mut self, value: Style) -> &mut Self { self.style = Box::new(value); self } + #[inline] pub fn get_coordinate(&self) -> &Coordinate { &self.coordinate } + #[inline] pub fn get_coordinate_mut(&mut self) -> &mut Coordinate { &mut self.coordinate } @@ -93,10 +101,12 @@ impl Cell { self } + #[inline] pub fn get_hyperlink(&self) -> Option<&Hyperlink> { self.hyperlink.as_deref() } + #[inline] pub fn get_hyperlink_mut(&mut self) -> &mut Hyperlink { if self.hyperlink.is_some() { return self.hyperlink.as_mut().unwrap(); @@ -105,28 +115,34 @@ impl Cell { self.hyperlink.as_mut().unwrap() } + #[inline] pub fn set_hyperlink(&mut self, value: Hyperlink) -> &mut Self { self.hyperlink = Some(Box::new(value)); self } + #[inline] pub fn get_cell_meta_index(&self) -> &u32 { self.cell_meta_index.get_value() } + #[inline] pub fn set_cell_meta_index(&mut self, value: u32) -> &mut Self { self.cell_meta_index.set_value(value); self } + #[inline] pub fn get_value(&self) -> Cow<'static, str> { self.cell_value.get_value() } + #[inline] pub fn get_value_number(&self) -> Option { self.cell_value.get_value_number() } + #[inline] pub fn get_value_lazy(&mut self) -> Cow<'static, str> { self.cell_value.get_value_lazy() } @@ -139,41 +155,49 @@ impl Cell { /// - `Bool` - if the string was either `"TRUE"` or `"FALSE"` /// - `Error` - if the string was either `"#VALUE!"`,`"#REF!"`,`"#NUM!"`,`"#NULL!"`,`"#NAME?"`,`"#N/A"`,`"#DATA!"` or `"#DIV/0!"` /// - `String` - if the string does not fulfill any of the other conditions + #[inline] pub fn set_value>(&mut self, value: S) -> &mut Self { self.cell_value.set_value(value); self } + #[inline] pub(crate) fn set_value_crate>(&mut self, value: S) -> &mut Self { self.cell_value.set_value_crate(value); self } + #[inline] pub fn set_value_lazy>(&mut self, value: S) -> &mut Self { self.cell_value.set_value_lazy(value); self } + #[inline] pub fn set_value_string>(&mut self, value: S) -> &mut Self { self.cell_value.set_value_string(value); self } + #[inline] pub(crate) fn set_value_string_crate>(&mut self, value: S) -> &mut Self { self.cell_value.set_value_string_crate(value); self } + #[inline] pub fn set_value_bool(&mut self, value: bool) -> &mut Self { self.cell_value.set_value_bool(value); self } + #[inline] pub(crate) fn set_value_bool_crate(&mut self, value: bool) -> &mut Self { self.cell_value.set_value_bool_crate(value); self } + #[inline] pub fn set_value_number(&mut self, value: T) -> &mut Self where T: Into, @@ -182,60 +206,73 @@ impl Cell { self } + #[inline] pub fn set_rich_text(&mut self, value: RichText) -> &mut Self { self.cell_value.set_rich_text(value); self } + #[inline] pub fn set_error>(&mut self, value: S) -> &mut Self { self.cell_value.set_error(value); self } + #[inline] pub fn set_formula>(&mut self, value: S) -> &mut Self { self.cell_value.set_formula(value); self } + #[inline] pub fn set_formula_result_default>(&mut self, value: S) -> &mut Self { self.cell_value.set_formula_result_default(value); self } + #[inline] pub fn set_blank(&mut self) -> &mut Self { self.cell_value.set_blank(); self } + #[inline] pub(crate) fn set_shared_string_item(&mut self, value: SharedStringItem) -> &mut Self { self.cell_value.set_shared_string_item(value); self } + #[inline] pub fn get_data_type(&self) -> &str { self.cell_value.get_data_type() } + #[inline] pub fn get_raw_value(&self) -> &CellRawValue { self.cell_value.get_raw_value() } + #[inline] pub(crate) fn get_data_type_crate(&self) -> &str { self.cell_value.get_data_type_crate() } + #[inline] pub fn is_formula(&self) -> bool { self.cell_value.is_formula() } + #[inline] pub fn get_formula(&self) -> &str { self.cell_value.get_formula() } + #[inline] pub fn get_formula_obj(&self) -> Option<&CellFormula> { self.cell_value.get_formula_obj() } + #[inline] pub fn get_formula_shared_index(&self) -> Option<&u32> { if let Some(v) = self.get_formula_obj() { if v.get_formula_type() == &CellFormulaValues::Shared { @@ -290,12 +327,14 @@ impl Cell { } // When opened in software such as Excel, it is visually blank. + #[inline] pub(crate) fn is_visually_empty(&self) -> bool { self.cell_value.is_visually_empty() && self.style.is_visually_empty() && self.hyperlink.is_none() } + #[inline] pub(crate) fn set_obj(&mut self, cell: Self) -> &mut Self { self.cell_value = cell.cell_value; self.style = cell.style; @@ -495,6 +534,7 @@ impl Cell { } } impl AdjustmentCoordinate for Cell { + #[inline] fn adjustment_insert_coordinate( &mut self, root_col_num: &u32, @@ -510,6 +550,7 @@ impl AdjustmentCoordinate for Cell { ); } + #[inline] fn adjustment_remove_coordinate( &mut self, root_col_num: &u32, @@ -526,6 +567,7 @@ impl AdjustmentCoordinate for Cell { } } impl AdjustmentCoordinateWith2Sheet for Cell { + #[inline] fn adjustment_insert_coordinate_with_2sheet( &mut self, self_sheet_name: &str, @@ -545,6 +587,7 @@ impl AdjustmentCoordinateWith2Sheet for Cell { ); } + #[inline] fn adjustment_remove_coordinate_with_2sheet( &mut self, self_sheet_name: &str, diff --git a/src/structs/cell_format.rs b/src/structs/cell_format.rs index e6c4388d..105a21a8 100644 --- a/src/structs/cell_format.rs +++ b/src/structs/cell_format.rs @@ -29,150 +29,184 @@ pub(crate) struct CellFormat { } impl CellFormat { + #[inline] pub(crate) fn get_number_format_id(&self) -> &u32 { self.number_format_id.get_value() } + #[inline] pub(crate) fn set_number_format_id(&mut self, value: u32) -> &mut Self { self.number_format_id.set_value(value); self } + #[inline] pub(crate) fn get_font_id(&self) -> &u32 { self.font_id.get_value() } + #[inline] pub(crate) fn set_font_id(&mut self, value: u32) -> &mut Self { self.font_id.set_value(value); self } + #[inline] pub(crate) fn get_fill_id(&self) -> &u32 { self.fill_id.get_value() } + #[inline] pub(crate) fn set_fill_id(&mut self, value: u32) -> &mut Self { self.fill_id.set_value(value); self } + #[inline] pub(crate) fn get_border_id(&self) -> &u32 { self.border_id.get_value() } + #[inline] pub(crate) fn set_border_id(&mut self, value: u32) -> &mut Self { self.border_id.set_value(value); self } + #[inline] pub(crate) fn get_format_id(&self) -> &u32 { self.format_id.get_value() } + #[inline] pub(crate) fn set_format_id(&mut self, value: u32) -> &mut Self { self.format_id.set_value(value); self } + #[inline] pub(crate) fn get_apply_number_format(&self) -> &bool { self.apply_number_format.get_value() } + #[inline] pub(crate) fn set_apply_number_format(&mut self, value: bool) -> &mut Self { self.apply_number_format.set_value(value); self } + #[inline] pub(crate) fn has_apply_number_format(&self) -> bool { self.apply_number_format.has_value() } + #[inline] pub(crate) fn get_apply_fill(&self) -> &bool { self.apply_fill.get_value() } + #[inline] pub(crate) fn set_apply_fill(&mut self, value: bool) -> &mut Self { self.apply_fill.set_value(value); self } + #[inline] pub(crate) fn has_apply_fill(&self) -> bool { self.apply_fill.has_value() } + #[inline] pub(crate) fn get_apply_border(&self) -> &bool { self.apply_border.get_value() } + #[inline] pub(crate) fn set_apply_border(&mut self, value: bool) -> &mut Self { self.apply_border.set_value(value); self } + #[inline] pub(crate) fn has_apply_border(&self) -> bool { self.apply_border.has_value() } + #[inline] pub(crate) fn get_apply_font(&self) -> &bool { self.apply_font.get_value() } + #[inline] pub(crate) fn set_apply_font(&mut self, value: bool) -> &mut Self { self.apply_font.set_value(value); self } + #[inline] pub(crate) fn has_apply_font(&self) -> bool { self.apply_font.has_value() } + #[inline] pub(crate) fn get_apply_alignment(&self) -> &bool { self.apply_alignment.get_value() } + #[inline] pub(crate) fn set_apply_alignment(&mut self, value: bool) -> &mut Self { self.apply_alignment.set_value(value); self } + #[inline] pub(crate) fn has_apply_alignment(&self) -> bool { self.apply_alignment.has_value() } + #[inline] pub(crate) fn get_apply_protection(&self) -> &bool { self.apply_protection.get_value() } + #[inline] pub(crate) fn set_apply_protection(&mut self, value: bool) -> &mut Self { self.apply_protection.set_value(value); self } + #[inline] pub(crate) fn has_apply_protection(&self) -> bool { self.apply_protection.has_value() } + #[inline] pub(crate) fn get_alignment(&self) -> Option<&Alignment> { self.alignment.as_ref() } + #[inline] pub(crate) fn _get_alignment_mut(&mut self) -> Option<&mut Alignment> { self.alignment.as_mut() } + #[inline] pub(crate) fn set_alignment(&mut self, value: Alignment) -> &mut Self { self.alignment = Some(value); self } + #[inline] pub(crate) fn get_protection(&self) -> Option<&Protection> { self.protection.as_ref() } + #[inline] pub(crate) fn _get_protection_mut(&mut self) -> Option<&mut Protection> { self.protection.as_mut() } + #[inline] pub(crate) fn set_protection(&mut self, value: Protection) -> &mut Self { self.protection = Some(value); self diff --git a/src/structs/cell_formats.rs b/src/structs/cell_formats.rs index c6cabd58..412461af 100644 --- a/src/structs/cell_formats.rs +++ b/src/structs/cell_formats.rs @@ -14,14 +14,17 @@ pub(crate) struct CellFormats { } impl CellFormats { + #[inline] pub(crate) fn get_cell_format(&self) -> &[CellFormat] { &self.cell_format } + #[inline] pub(crate) fn _get_cell_format_mut(&mut self) -> &mut ThinVec { &mut self.cell_format } + #[inline] pub(crate) fn set_cell_format(&mut self, value: CellFormat) -> &mut Self { self.cell_format.push(value); self diff --git a/src/structs/cell_formula.rs b/src/structs/cell_formula.rs index e9f00c0d..f24fa1ba 100644 --- a/src/structs/cell_formula.rs +++ b/src/structs/cell_formula.rs @@ -31,95 +31,116 @@ pub struct CellFormula { text_view: StringValue, } impl CellFormula { + #[inline] pub fn get_bx(&self) -> &bool { self.bx.get_value() } + #[inline] pub fn set_bx(&mut self, value: bool) -> &mut Self { self.bx.set_value(value); self } + #[inline] pub fn get_data_table_2d(&self) -> &bool { self.data_table_2d.get_value() } + #[inline] pub fn set_data_table_2d(&mut self, value: bool) -> &mut Self { self.data_table_2d.set_value(value); self } + #[inline] pub fn get_data_table_row(&self) -> &bool { self.data_table_row.get_value() } + #[inline] pub fn set_data_table_row(&mut self, value: bool) -> &mut Self { self.data_table_row.set_value(value); self } + #[inline] pub fn get_formula_type(&self) -> &CellFormulaValues { self.formula_type.get_value() } + #[inline] pub fn set_formula_type(&mut self, value: CellFormulaValues) { self.formula_type.set_value(value); } + #[inline] pub fn get_input_1deleted(&self) -> &bool { self.input_1deleted.get_value() } + #[inline] pub fn set_input_1deleted(&mut self, value: bool) -> &mut Self { self.input_1deleted.set_value(value); self } + #[inline] pub fn get_input_2deleted(&self) -> &bool { self.input_2deleted.get_value() } + #[inline] pub fn set_input_2deleted(&mut self, value: bool) -> &mut Self { self.input_2deleted.set_value(value); self } + #[inline] pub fn get_r1(&self) -> &str { self.r1.get_value_str() } + #[inline] pub fn set_r1>(&mut self, value: S) -> &mut Self { self.r1.set_value(value); self } + #[inline] pub fn get_r2(&self) -> &str { self.r2.get_value_str() } + #[inline] pub fn set_r2>(&mut self, value: S) -> &mut Self { self.r2.set_value(value); self } + #[inline] pub fn get_reference(&self) -> &str { self.reference.get_value_str() } + #[inline] pub fn set_reference>(&mut self, value: S) -> &mut Self { self.reference.set_value(value); self } + #[inline] pub fn get_shared_index(&self) -> &u32 { self.shared_index.get_value() } + #[inline] pub fn set_shared_index(&mut self, value: u32) -> &mut Self { self.shared_index.set_value(value); self } + #[inline] pub fn get_text(&self) -> &str { if self.text_view.has_value() { return self.text_view.get_value_str(); @@ -127,11 +148,13 @@ impl CellFormula { self.text.get_value_str() } + #[inline] pub fn set_text>(&mut self, value: S) -> &mut Self { self.text.set_value(value); self } + #[inline] pub fn set_text_view>(&mut self, value: S) -> &mut Self { self.text_view.set_value(value); self diff --git a/src/structs/cell_formula_values.rs b/src/structs/cell_formula_values.rs index b7c483e7..72e3d76c 100644 --- a/src/structs/cell_formula_values.rs +++ b/src/structs/cell_formula_values.rs @@ -8,11 +8,13 @@ pub enum CellFormulaValues { Shared, } impl Default for CellFormulaValues { + #[inline] fn default() -> Self { Self::Normal } } impl EnumTrait for CellFormulaValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::Array => "array", @@ -24,6 +26,8 @@ impl EnumTrait for CellFormulaValues { } impl FromStr for CellFormulaValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "array" => Ok(Self::Array), diff --git a/src/structs/cell_raw_value.rs b/src/structs/cell_raw_value.rs index aae29429..907bdeed 100644 --- a/src/structs/cell_raw_value.rs +++ b/src/structs/cell_raw_value.rs @@ -15,6 +15,7 @@ pub enum CellRawValue { Empty, } impl fmt::Display for CellRawValue { + #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Self::String(v) => write!(f, "{v}"), @@ -28,6 +29,7 @@ impl fmt::Display for CellRawValue { } impl CellRawValue { + #[inline] pub fn get_data_type(&self) -> &str { match self { Self::String(_) => "s", @@ -39,6 +41,7 @@ impl CellRawValue { } } + #[inline] pub(crate) fn get_text(&self) -> Option { match self { Self::String(_) | // _ @@ -52,6 +55,7 @@ impl CellRawValue { } } + #[inline] pub(crate) fn get_number(&self) -> Option { match self { Self::Numeric(number) => Some(*number), @@ -59,6 +63,7 @@ impl CellRawValue { } } + #[inline] pub fn get_rich_text(&self) -> Option { match self { Self::RichText(v) => Some(v.clone()), @@ -66,10 +71,12 @@ impl CellRawValue { } } + #[inline] pub fn is_error(&self) -> bool { matches!(*self, CellRawValue::Error(_)) } + #[inline] pub fn is_empty(&self) -> bool { matches!(*self, CellRawValue::Empty) } diff --git a/src/structs/cell_style.rs b/src/structs/cell_style.rs index 9e215056..9d91ea97 100644 --- a/src/structs/cell_style.rs +++ b/src/structs/cell_style.rs @@ -16,33 +16,40 @@ pub struct CellStyle { } impl CellStyle { + #[inline] pub fn get_name(&self) -> &str { self.name.get_value_str() } + #[inline] pub fn set_name>(&mut self, value: S) -> &mut Self { self.name.set_value(value); self } + #[inline] pub fn get_builtin_id(&self) -> &u32 { self.builtin_id.get_value() } + #[inline] pub fn set_builtin_id(&mut self, value: u32) -> &mut Self { self.builtin_id.set_value(value); self } + #[inline] pub fn get_format_id(&self) -> &u32 { self.format_id.get_value() } + #[inline] pub fn set_format_id(&mut self, value: u32) -> &mut Self { self.format_id.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -53,6 +60,7 @@ impl CellStyle { set_string_from_xml!(self, e, format_id, "xfId"); } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { // cellStyle let mut attributes: Vec<(&str, &str)> = Vec::new(); diff --git a/src/structs/cell_style_formats.rs b/src/structs/cell_style_formats.rs index a347b7a6..81acf398 100644 --- a/src/structs/cell_style_formats.rs +++ b/src/structs/cell_style_formats.rs @@ -14,14 +14,17 @@ pub(crate) struct CellStyleFormats { } impl CellStyleFormats { + #[inline] pub(crate) fn get_cell_format(&self) -> &[CellFormat] { &self.cell_format } + #[inline] pub(crate) fn _get_cell_format_mut(&mut self) -> &mut ThinVec { &mut self.cell_format } + #[inline] pub(crate) fn set_cell_format(&mut self, value: CellFormat) -> &mut Self { self.cell_format.push(value); self diff --git a/src/structs/cell_styles.rs b/src/structs/cell_styles.rs index ef0cce5c..ae3f4c62 100644 --- a/src/structs/cell_styles.rs +++ b/src/structs/cell_styles.rs @@ -14,14 +14,17 @@ pub struct CellStyles { } impl CellStyles { + #[inline] pub fn _get_cell_style(&self) -> &[CellStyle] { &self.cell_style } + #[inline] pub fn _get_cell_style_mut(&mut self) -> &mut ThinVec { &mut self.cell_style } + #[inline] pub fn add_cell_style(&mut self, value: CellStyle) -> &mut Self { self.cell_style.push(value); self diff --git a/src/structs/cell_value.rs b/src/structs/cell_value.rs index 82ed3a7b..5708268e 100644 --- a/src/structs/cell_value.rs +++ b/src/structs/cell_value.rs @@ -15,14 +15,17 @@ pub struct CellValue { pub(crate) formula: Option>, } impl CellValue { + #[inline] pub fn get_data_type(&self) -> &str { self.raw_value.get_data_type() } + #[inline] pub fn get_raw_value(&self) -> &CellRawValue { &self.raw_value } + #[inline] pub(crate) fn get_data_type_crate(&self) -> &str { match &self.formula { Some(_) => "str", @@ -30,14 +33,17 @@ impl CellValue { } } + #[inline] pub fn get_value(&self) -> Cow<'static, str> { self.raw_value.to_string().into() } + #[inline] pub fn get_value_number(&self) -> Option { self.raw_value.get_number() } + #[inline] pub fn get_value_lazy(&mut self) -> Cow<'static, str> { if let CellRawValue::Lazy(v) = &self.raw_value { self.raw_value = Self::guess_typed_data(v); @@ -46,10 +52,12 @@ impl CellValue { self.raw_value.to_string().into() } + #[inline] pub(crate) fn get_text(&self) -> Option { self.raw_value.get_text() } + #[inline] pub(crate) fn get_rich_text(&self) -> Option { self.raw_value.get_rich_text() } @@ -62,44 +70,52 @@ impl CellValue { /// - `Bool` - if the string was either `"TRUE"` or `"FALSE"` /// - `Error` - if the string was either `"#VALUE!"`,`"#REF!"`,`"#NUM!"`,`"#NULL!"`,`"#NAME?"`,`"#N/A"`,`"#DATA!"` or `"#DIV/0!"` /// - `String` - if the string does not fulfill any of the other conditions + #[inline] pub fn set_value>(&mut self, value: S) -> &mut Self { self.raw_value = Self::guess_typed_data(&value.into()); self.remove_formula(); self } + #[inline] pub(crate) fn set_value_crate>(&mut self, value: S) -> &mut Self { self.raw_value = Self::guess_typed_data(&value.into()); self } + #[inline] pub fn set_value_lazy>(&mut self, value: S) -> &mut Self { self.raw_value = CellRawValue::Lazy(value.into().into_boxed_str()); self } + #[inline] pub fn set_value_string>(&mut self, value: S) -> &mut Self { self.raw_value = CellRawValue::String(value.into().into_boxed_str()); self.remove_formula(); self } + #[inline] pub(crate) fn set_value_string_crate>(&mut self, value: S) -> &mut Self { self.raw_value = CellRawValue::String(value.into().into_boxed_str()); self } + #[inline] pub fn set_value_bool(&mut self, value: bool) -> &mut Self { self.raw_value = CellRawValue::Bool(value); self.remove_formula(); self } + #[inline] pub(crate) fn set_value_bool_crate(&mut self, value: bool) -> &mut Self { self.raw_value = CellRawValue::Bool(value); self } + #[inline] pub fn set_value_number(&mut self, value: T) -> &mut Self where T: Into, @@ -109,22 +125,26 @@ impl CellValue { self } + #[inline] pub fn set_rich_text(&mut self, value: RichText) -> &mut Self { self.raw_value = CellRawValue::RichText(value); self.remove_formula(); self } + #[inline] pub fn set_blank(&mut self) -> &mut Self { self.raw_value = CellRawValue::Empty; self.remove_formula(); self } + #[inline] pub fn is_formula(&self) -> bool { self.formula.is_some() } + #[inline] pub fn get_formula(&self) -> &str { match &self.formula { Some(v) => v.get_text(), @@ -132,10 +152,12 @@ impl CellValue { } } + #[inline] pub fn get_formula_obj(&self) -> Option<&CellFormula> { self.formula.as_deref() } + #[inline] pub fn set_formula>(&mut self, value: S) -> &mut Self { let mut obj = CellFormula::default(); obj.set_text(value.into()); @@ -143,30 +165,36 @@ impl CellValue { self } + #[inline] pub fn set_formula_obj(&mut self, value: CellFormula) -> &mut Self { self.formula = Some(Box::new(value)); self } + #[inline] pub fn remove_formula(&mut self) -> &mut Self { self.formula = None; self } + #[inline] pub fn set_formula_result_default>(&mut self, value: S) -> &mut Self { self.set_value_crate(value); self } + #[inline] pub fn set_error>(&mut self, value: S) -> &mut Self { self.set_value_crate(value); self } + #[inline] pub fn is_error(&self) -> bool { self.raw_value.is_error() } + #[inline] pub(crate) fn set_shared_string_item(&mut self, value: SharedStringItem) -> &mut Self { if let Some(v) = value.get_text() { self.set_value_string(v.get_value()); @@ -177,6 +205,7 @@ impl CellValue { self } + #[inline] pub(crate) fn guess_typed_data(value: &str) -> CellRawValue { let uppercase_value = value.to_uppercase(); @@ -196,24 +225,29 @@ impl CellValue { } } + #[inline] pub fn is_empty(&self) -> bool { self.is_value_empty() && self.is_formula_empty() } + #[inline] pub(crate) fn is_value_empty(&self) -> bool { self.raw_value.is_empty() } + #[inline] pub(crate) fn is_formula_empty(&self) -> bool { !self.is_formula() } // When opened in software such as Excel, it is visually blank. + #[inline] pub(crate) fn is_visually_empty(&self) -> bool { self.get_value() == "" && self.is_formula_empty() } } impl AdjustmentCoordinateWith2Sheet for CellValue { + #[inline] fn adjustment_insert_coordinate_with_2sheet( &mut self, self_sheet_name: &str, @@ -235,6 +269,7 @@ impl AdjustmentCoordinateWith2Sheet for CellValue { } } + #[inline] fn adjustment_remove_coordinate_with_2sheet( &mut self, self_sheet_name: &str, diff --git a/src/structs/cells.rs b/src/structs/cells.rs index 0192e091..b2eb0fd3 100644 --- a/src/structs/cells.rs +++ b/src/structs/cells.rs @@ -17,6 +17,7 @@ pub struct Cells { default_style: Style, } impl Cells { + #[inline] pub fn get_collection(&self) -> Vec<&Cell> { self.map.values().map(Box::as_ref).collect() } @@ -36,14 +37,17 @@ impl Cells { cells } + #[inline] pub(crate) fn get_collection_mut(&mut self) -> Vec<&mut Cell> { self.map.values_mut().map(Box::as_mut).collect() } + #[inline] pub fn get_collection_to_hashmap(&self) -> &HashMap<(u32, u32), Box> { &self.map } + #[inline] pub fn get_collection_by_column(&self, column_num: &u32) -> Vec<&Cell> { self.map .values() @@ -52,6 +56,7 @@ impl Cells { .collect() } + #[inline] pub fn get_collection_by_row(&self, row_num: &u32) -> Vec<&Cell> { self.map .values() @@ -60,6 +65,7 @@ impl Cells { .collect() } + #[inline] pub fn get_collection_by_column_to_hashmap(&self, column_num: &u32) -> HashMap { self.map .iter() @@ -68,6 +74,7 @@ impl Cells { .collect() } + #[inline] pub fn get_collection_by_row_to_hashmap(&self, row_num: &u32) -> HashMap { self.map .iter() @@ -76,6 +83,7 @@ impl Cells { .collect() } + #[inline] pub(crate) fn get_collection_to_hashmap_mut(&mut self) -> &mut HashMap<(u32, u32), Box> { &mut self.map } @@ -95,10 +103,12 @@ impl Cells { } /// Has Hyperlink + #[inline] pub fn has_hyperlink(&self) -> bool { self.map.values().any(|c| c.get_hyperlink().is_some()) } + #[inline] pub fn get(&self, coordinate: T) -> Option<&Cell> where T: Into, @@ -135,6 +145,7 @@ impl Cells { }) } + #[inline] pub fn get_cell_value(&self, coordinate: T) -> &CellValue where T: Into, @@ -146,6 +157,7 @@ impl Cells { .unwrap_or(&self.default_cell_value) } + #[inline] pub fn get_style(&self, coordinate: T) -> &Style where T: Into, @@ -157,6 +169,7 @@ impl Cells { .unwrap_or(&self.default_style) } + #[inline] pub(crate) fn set( &mut self, cell: Cell, @@ -170,11 +183,13 @@ impl Cells { self } + #[inline] pub(crate) fn set_fast(&mut self, cell: Cell) -> &mut Self { self.add(cell); self } + #[inline] pub(crate) fn add(&mut self, cell: Cell) { let col_num = cell.get_coordinate().get_col_num(); let row_num = cell.get_coordinate().get_row_num(); @@ -182,6 +197,7 @@ impl Cells { self.map.insert_unique_unchecked(k, Box::new(cell)); } + #[inline] pub(crate) fn remove(&mut self, col_num: &u32, row_num: &u32) -> bool { let k = (*row_num, *col_num); self.map.remove(&k).is_some() @@ -207,6 +223,7 @@ impl Cells { result } + #[inline] pub fn get_formatted_value_by_column_and_row(&self, col_num: &u32, row_num: &u32) -> String { match self.get((col_num, row_num)) { Some(v) => v.get_formatted_value(), @@ -231,6 +248,7 @@ impl Cells { } } impl AdjustmentCoordinate for Cells { + #[inline] fn adjustment_insert_coordinate( &mut self, root_col_num: &u32, @@ -250,6 +268,7 @@ impl AdjustmentCoordinate for Cells { self.rebuild_map(); } + #[inline] fn adjustment_remove_coordinate( &mut self, root_col_num: &u32, @@ -278,6 +297,7 @@ impl AdjustmentCoordinate for Cells { } } impl AdjustmentCoordinateWith2Sheet for Cells { + #[inline] fn adjustment_insert_coordinate_with_2sheet( &mut self, self_sheet_name: &str, @@ -299,6 +319,7 @@ impl AdjustmentCoordinateWith2Sheet for Cells { } } + #[inline] fn adjustment_remove_coordinate_with_2sheet( &mut self, self_sheet_name: &str, diff --git a/src/structs/chart.rs b/src/structs/chart.rs index 58d0bdd6..4ab67a05 100644 --- a/src/structs/chart.rs +++ b/src/structs/chart.rs @@ -137,6 +137,7 @@ pub struct Chart { } impl Default for Chart { + #[inline] fn default() -> Self { Self { two_cell_anchor: Box::new(TwoCellAnchor::default()), @@ -145,12 +146,14 @@ impl Default for Chart { } } impl Chart { + #[inline] pub fn set_title>(&mut self, value: S) -> &mut Self { let title = self.make_title(value); self.get_chart_space_mut().get_chart_mut().set_title(title); self } + #[inline] pub fn set_grouping(&mut self, value: GroupingValues) -> &mut Self { self.get_plot_area_mut().set_grouping(value); self @@ -235,12 +238,15 @@ impl Chart { } self } + + #[inline] pub fn get_plot_area_mut(&mut self) -> &mut PlotArea { self.get_chart_space_mut() .get_chart_mut() .get_plot_area_mut() } + #[inline] pub fn get_area_chart_series_list_mut(&mut self) -> &mut AreaChartSeriesList { self.get_chart_space_mut() .get_chart_mut() @@ -248,19 +254,23 @@ impl Chart { .get_area_chart_series_list_mut() } + #[inline] pub fn get_two_cell_anchor(&self) -> &TwoCellAnchor { &self.two_cell_anchor } + #[inline] pub fn get_two_cell_anchor_mut(&mut self) -> &mut TwoCellAnchor { &mut self.two_cell_anchor } + #[inline] pub fn set_two_cell_anchor(&mut self, value: TwoCellAnchor) -> &mut Self { self.two_cell_anchor = Box::new(value); self } + #[inline] pub fn set_default_language>(&mut self, value: S) -> &mut Self { self.default_language = value.into(); self @@ -346,14 +356,17 @@ impl Chart { self } + #[inline] pub fn get_coordinate(&self) -> String { self.two_cell_anchor.get_from_marker().get_coordinate() } + #[inline] pub(crate) fn get_col(&self) -> &u32 { self.two_cell_anchor.get_from_marker().get_col() } + #[inline] pub(crate) fn get_row(&self) -> &u32 { self.two_cell_anchor.get_from_marker().get_row() } @@ -2153,6 +2166,7 @@ impl Chart { self.two_cell_anchor.set_graphic_frame(graphic_frame); } + #[inline] pub(crate) fn make_print_settings(&self) -> PrintSettings { let mut obj = PrintSettings::default(); obj.get_page_margins_mut() @@ -2192,6 +2206,7 @@ impl Chart { } } impl AdjustmentCoordinate for Chart { + #[inline] fn adjustment_insert_coordinate( &mut self, root_col_num: &u32, @@ -2207,6 +2222,7 @@ impl AdjustmentCoordinate for Chart { ); } + #[inline] fn adjustment_remove_coordinate( &mut self, root_col_num: &u32, @@ -2222,6 +2238,7 @@ impl AdjustmentCoordinate for Chart { ); } + #[inline] fn is_remove_coordinate( &self, root_col_num: &u32, @@ -2238,6 +2255,7 @@ impl AdjustmentCoordinate for Chart { } } impl AdjustmentCoordinateWithSheet for Chart { + #[inline] fn adjustment_insert_coordinate_with_sheet( &mut self, sheet_name: &str, @@ -2257,6 +2275,7 @@ impl AdjustmentCoordinateWithSheet for Chart { ); } + #[inline] fn adjustment_remove_coordinate_with_sheet( &mut self, sheet_name: &str, diff --git a/src/structs/chart_type.rs b/src/structs/chart_type.rs index 2df2db0f..59a63d5e 100644 --- a/src/structs/chart_type.rs +++ b/src/structs/chart_type.rs @@ -22,6 +22,7 @@ impl Default for ChartType { } } impl EnumTrait for ChartType { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::LineChart => "line_chart", @@ -42,6 +43,8 @@ impl EnumTrait for ChartType { } impl FromStr for ChartType { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "line_chart" => Ok(Self::LineChart), diff --git a/src/structs/color.rs b/src/structs/color.rs index e6a3f771..738734af 100644 --- a/src/structs/color.rs +++ b/src/structs/color.rs @@ -157,10 +157,12 @@ impl Color { self } + #[inline] pub fn get_indexed(&self) -> &u32 { self.indexed.get_value() } + #[inline] pub fn set_indexed(&mut self, index: u32) -> &mut Self { self.indexed.set_value(index); self.theme_index.remove_value(); @@ -168,10 +170,12 @@ impl Color { self } + #[inline] pub fn get_theme_index(&self) -> &u32 { self.theme_index.get_value() } + #[inline] pub fn set_theme_index(&mut self, index: u32) -> &mut Self { self.indexed.remove_value(); self.theme_index.set_value(index); @@ -179,15 +183,18 @@ impl Color { self } + #[inline] pub fn get_tint(&self) -> &f64 { self.tint.get_value() } + #[inline] pub fn set_tint(&mut self, value: f64) -> &mut Color { self.tint.set_value(value); self } + #[inline] pub(crate) fn has_value(&self) -> bool { self.theme_index.has_value() || self.indexed.has_value() @@ -195,6 +202,7 @@ impl Color { || self.tint.has_value() } + #[inline] pub(crate) fn get_hash_code(&self) -> String { format!( "{:x}", @@ -209,6 +217,7 @@ impl Color { } // When opened in software such as Excel, it is visually blank. + #[inline] pub(crate) fn is_visually_empty(&self) -> bool { !self.has_value() } @@ -269,21 +278,25 @@ impl Color { } } + #[inline] pub(crate) fn write_to_color(&self, writer: &mut Writer>>) { // color self.write_to(writer, "color"); } + #[inline] pub(crate) fn write_to_fg_color(&self, writer: &mut Writer>>) { // fgColor self.write_to(writer, "fgColor"); } + #[inline] pub(crate) fn write_to_bg_color(&self, writer: &mut Writer>>) { // bgColor self.write_to(writer, "bgColor"); } + #[inline] pub(crate) fn write_to_tab_color(&self, writer: &mut Writer>>) { // tabColor self.write_to(writer, "tabColor"); diff --git a/src/structs/color_scale.rs b/src/structs/color_scale.rs index deb7a9c4..1859511c 100644 --- a/src/structs/color_scale.rs +++ b/src/structs/color_scale.rs @@ -16,10 +16,12 @@ pub struct ColorScale { } impl ColorScale { + #[inline] pub fn get_cfvo_collection(&self) -> &[ConditionalFormatValueObject] { &self.cfvo_collection } + #[inline] pub fn set_cfvo_collection( &mut self, value: ThinVec, @@ -28,20 +30,24 @@ impl ColorScale { self } + #[inline] pub fn add_cfvo_collection(&mut self, value: ConditionalFormatValueObject) -> &mut Self { self.cfvo_collection.push(value); self } + #[inline] pub fn get_color_collection(&self) -> &[Color] { &self.color_collection } + #[inline] pub fn set_color_collection(&mut self, value: impl Into>) -> &mut Self { self.color_collection = value.into(); self } + #[inline] pub fn add_color_collection(&mut self, value: Color) -> &mut Self { self.color_collection.push(value); self diff --git a/src/structs/colors.rs b/src/structs/colors.rs index 0c3e971d..6348c0c0 100644 --- a/src/structs/colors.rs +++ b/src/structs/colors.rs @@ -13,14 +13,17 @@ pub(crate) struct Colors { } impl Colors { + #[inline] pub(crate) fn _get_mru_colors(&self) -> &MruColors { &self.mru_colors } + #[inline] pub(crate) fn _get_mru_colors_mut(&mut self) -> &mut MruColors { &mut self.mru_colors } + #[inline] pub(crate) fn _set_mru_colors(&mut self, value: MruColors) -> &mut Self { self.mru_colors = value; self diff --git a/src/structs/column.rs b/src/structs/column.rs index 5a8bce1f..b53243ee 100644 --- a/src/structs/column.rs +++ b/src/structs/column.rs @@ -36,6 +36,7 @@ pub struct Column { } impl Default for Column { + #[inline] fn default() -> Self { let mut width = DoubleValue::default(); width.set_value(8.38f64); @@ -51,59 +52,72 @@ impl Default for Column { } impl Column { + #[inline] pub fn get_col_num(&self) -> &u32 { self.col_num.get_value() } + #[inline] pub fn set_col_num(&mut self, value: u32) -> &mut Self { self.col_num.set_value(value); self } + #[inline] pub fn get_width(&self) -> &f64 { self.width.get_value() } + #[inline] pub fn set_width(&mut self, value: f64) -> &mut Self { self.width.set_value(value); self } + #[inline] pub fn get_hidden(&self) -> &bool { self.hidden.get_value() } + #[inline] pub fn set_hidden(&mut self, value: bool) -> &mut Self { self.hidden.set_value(value); self } + #[inline] pub fn get_best_fit(&self) -> &bool { self.best_fit.get_value() } + #[inline] pub fn set_best_fit(&mut self, value: bool) -> &mut Self { self.best_fit.set_value(value); self } + #[inline] pub fn get_style(&self) -> &Style { &self.style } + #[inline] pub fn get_style_mut(&mut self) -> &mut Style { &mut self.style } + #[inline] pub fn set_style(&mut self, value: Style) -> &mut Self { self.style = Box::new(value); self } + #[inline] pub fn get_auto_width(&self) -> &bool { self.auto_width.get_value() } + #[inline] pub fn set_auto_width(&mut self, value: bool) -> &mut Self { self.auto_width.set_value(value); self @@ -145,10 +159,12 @@ impl Column { self } + #[inline] pub(crate) fn has_style(&self) -> bool { &*self.style != &Style::default() } + #[inline] pub(crate) fn get_hash_code(&self) -> String { format!( "{:x}", @@ -178,6 +194,7 @@ impl Column { } } impl AdjustmentValue for Column { + #[inline] fn adjustment_insert_value(&mut self, root_num: &u32, offset_num: &u32) { if self.col_num.get_value() >= root_num { self.col_num @@ -185,6 +202,7 @@ impl AdjustmentValue for Column { } } + #[inline] fn adjustment_remove_value(&mut self, root_num: &u32, offset_num: &u32) { if self.col_num.get_value() >= root_num { self.col_num @@ -192,6 +210,7 @@ impl AdjustmentValue for Column { } } + #[inline] fn is_remove_value(&self, root_num: &u32, offset_num: &u32) -> bool { self.col_num.get_value() >= root_num && self.col_num.get_value() <= &(root_num + offset_num - 1) diff --git a/src/structs/column_breaks.rs b/src/structs/column_breaks.rs index 375b1cfe..497eea48 100644 --- a/src/structs/column_breaks.rs +++ b/src/structs/column_breaks.rs @@ -14,19 +14,23 @@ pub struct ColumnBreaks { } impl ColumnBreaks { + #[inline] pub fn get_break_list(&self) -> &[Break] { &self.break_list } + #[inline] pub fn get_break_list_mut(&mut self) -> &mut ThinVec { &mut self.break_list } + #[inline] pub fn add_break_list(&mut self, value: Break) -> &mut Self { self.break_list.push(value); self } + #[inline] pub(crate) fn has_param(&self) -> bool { !self.break_list.is_empty() } diff --git a/src/structs/column_reference.rs b/src/structs/column_reference.rs index cb85b0ad..bbae7bed 100644 --- a/src/structs/column_reference.rs +++ b/src/structs/column_reference.rs @@ -8,6 +8,7 @@ pub struct ColumnReference { } impl Default for ColumnReference { + #[inline] fn default() -> Self { Self { num: 1, @@ -17,15 +18,18 @@ impl Default for ColumnReference { } impl ColumnReference { + #[inline] pub fn get_num(&self) -> &u32 { &self.num } + #[inline] pub fn set_num(&mut self, value: u32) -> &mut Self { self.num = value; self } + #[inline] pub(crate) fn offset_num(&mut self, value: i32) -> &mut Self { if value > 0 { self.plus_num(value as u32); @@ -36,30 +40,36 @@ impl ColumnReference { self } + #[inline] pub(crate) fn plus_num(&mut self, value: u32) -> &mut Self { self.num += value; self } + #[inline] pub(crate) fn minus_num(&mut self, value: u32) -> &mut Self { self.num -= value; self } + #[inline] pub fn get_is_lock(&self) -> &bool { &self.is_lock } + #[inline] pub fn set_is_lock(&mut self, value: bool) -> &mut Self { self.is_lock = value; self } + #[inline] pub fn set_is_lock_usize(&mut self, value: u32) -> &mut Self { self.is_lock = value == 1; self } + #[inline] pub(crate) fn get_coordinate(&self) -> String { format!( "{}{}", @@ -69,14 +79,17 @@ impl ColumnReference { } } impl AdjustmentValue for ColumnReference { + #[inline] fn adjustment_insert_value(&mut self, root_num: &u32, offset_num: &u32) { self.num = adjustment_insert_coordinate(&self.num, root_num, offset_num); } + #[inline] fn adjustment_remove_value(&mut self, root_num: &u32, offset_num: &u32) { self.num = adjustment_remove_coordinate(&self.num, root_num, offset_num); } + #[inline] fn is_remove_value(&self, root_num: &u32, offset_num: &u32) -> bool { is_remove_coordinate(&self.num, root_num, offset_num) } diff --git a/src/structs/columns.rs b/src/structs/columns.rs index b07e509a..c8cff92f 100644 --- a/src/structs/columns.rs +++ b/src/structs/columns.rs @@ -18,14 +18,17 @@ pub(crate) struct Columns { } impl Columns { + #[inline] pub(crate) fn get_column_collection(&self) -> &[Column] { &self.column } + #[inline] pub(crate) fn get_column_collection_mut(&mut self) -> &mut ThinVec { &mut self.column } + #[inline] pub(crate) fn get_column(&self, value: &u32) -> Option<&Column> { self.column .iter() @@ -46,6 +49,7 @@ impl Columns { panic!("Column not found."); } + #[inline] pub(crate) fn set_column(&mut self, value: Column) -> &mut Self { self.column.push(value); self diff --git a/src/structs/comment.rs b/src/structs/comment.rs index 639e1bf1..df3629b4 100644 --- a/src/structs/comment.rs +++ b/src/structs/comment.rs @@ -18,57 +18,70 @@ pub struct Comment { } impl Comment { + #[inline] pub fn get_coordinate(&self) -> &Coordinate { &self.coordinate } + #[inline] pub fn get_coordinate_mut(&mut self) -> &mut Coordinate { &mut self.coordinate } + #[inline] pub fn get_author(&self) -> &str { &self.author } + #[inline] pub fn set_author>(&mut self, value: S) -> &mut Self { self.author = value.into().into_boxed_str(); self } + #[inline] pub fn get_text(&self) -> &RichText { &self.text } + #[inline] pub fn get_text_mut(&mut self) -> &mut RichText { &mut self.text } + #[inline] pub fn set_text(&mut self, value: RichText) -> &mut Self { self.text = value; self } + #[inline] pub fn get_anchor(&self) -> &Anchor { self.shape.get_client_data().get_anchor() } + #[inline] pub fn get_anchor_mut(&mut self) -> &mut Anchor { self.shape.get_client_data_mut().get_anchor_mut() } + #[inline] pub fn set_anchor(&mut self, value: Anchor) -> &mut Self { self.shape.get_client_data_mut().set_anchor(value); self } + #[inline] pub fn get_shape(&self) -> &Shape { &self.shape } + #[inline] pub fn get_shape_mut(&mut self) -> &mut Shape { &mut self.shape } + #[inline] pub fn set_shape(&mut self, value: Shape) -> &mut Self { self.shape = value; self @@ -107,6 +120,7 @@ impl Comment { } } impl AdjustmentCoordinate for Comment { + #[inline] fn adjustment_insert_coordinate( &mut self, root_col_num: &u32, @@ -128,6 +142,7 @@ impl AdjustmentCoordinate for Comment { ); } + #[inline] fn adjustment_remove_coordinate( &mut self, root_col_num: &u32, @@ -149,6 +164,7 @@ impl AdjustmentCoordinate for Comment { ); } + #[inline] fn is_remove_coordinate( &self, root_col_num: &u32, diff --git a/src/structs/conditional_format_value_object.rs b/src/structs/conditional_format_value_object.rs index 00016176..35552e3d 100644 --- a/src/structs/conditional_format_value_object.rs +++ b/src/structs/conditional_format_value_object.rs @@ -15,19 +15,23 @@ pub struct ConditionalFormatValueObject { } impl ConditionalFormatValueObject { + #[inline] pub fn get_type(&self) -> &ConditionalFormatValueObjectValues { self.r#type.get_value() } + #[inline] pub fn set_type(&mut self, value: ConditionalFormatValueObjectValues) -> &mut Self { self.r#type.set_value(value); self } + #[inline] pub fn get_val(&self) -> &str { self.val.get_value_str() } + #[inline] pub fn set_val>(&mut self, value: S) -> &mut Self { self.val.set_value(value.into()); self diff --git a/src/structs/conditional_format_value_object_values.rs b/src/structs/conditional_format_value_object_values.rs index e6172bcb..b8300bc1 100644 --- a/src/structs/conditional_format_value_object_values.rs +++ b/src/structs/conditional_format_value_object_values.rs @@ -10,11 +10,13 @@ pub enum ConditionalFormatValueObjectValues { Percentile, } impl Default for ConditionalFormatValueObjectValues { + #[inline] fn default() -> Self { Self::Number } } impl EnumTrait for ConditionalFormatValueObjectValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::Formula => "formula", @@ -28,6 +30,8 @@ impl EnumTrait for ConditionalFormatValueObjectValues { } impl FromStr for ConditionalFormatValueObjectValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "formula" => Ok(Self::Formula), diff --git a/src/structs/conditional_format_values.rs b/src/structs/conditional_format_values.rs index 20d1b846..3fc924a5 100644 --- a/src/structs/conditional_format_values.rs +++ b/src/structs/conditional_format_values.rs @@ -22,11 +22,13 @@ pub enum ConditionalFormatValues { UniqueValues, } impl Default for ConditionalFormatValues { + #[inline] fn default() -> Self { Self::Expression } } impl EnumTrait for ConditionalFormatValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::AboveAverage => "aboveAverage", @@ -52,6 +54,8 @@ impl EnumTrait for ConditionalFormatValues { } impl FromStr for ConditionalFormatValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "aboveAverage" => Ok(Self::AboveAverage), diff --git a/src/structs/conditional_formatting.rs b/src/structs/conditional_formatting.rs index 8fe3c066..f47cc9ee 100644 --- a/src/structs/conditional_formatting.rs +++ b/src/structs/conditional_formatting.rs @@ -18,27 +18,33 @@ pub struct ConditionalFormatting { } impl ConditionalFormatting { + #[inline] pub fn get_sequence_of_references(&self) -> &SequenceOfReferences { &self.sequence_of_references } + #[inline] pub fn get_sequence_of_references_mut(&mut self) -> &mut SequenceOfReferences { &mut self.sequence_of_references } + #[inline] pub fn set_sequence_of_references(&mut self, value: SequenceOfReferences) -> &mut Self { self.sequence_of_references = value; self } + #[inline] pub fn get_conditional_collection(&self) -> &[ConditionalFormattingRule] { &self.conditional_collection } + #[inline] pub fn get_conditional_collection_mut(&mut self) -> &mut ThinVec { &mut self.conditional_collection } + #[inline] pub fn set_conditional_collection( &mut self, value: impl Into>, @@ -47,6 +53,7 @@ impl ConditionalFormatting { self } + #[inline] pub fn add_conditional_collection(&mut self, value: ConditionalFormattingRule) -> &mut Self { self.conditional_collection.push(value); self @@ -113,6 +120,7 @@ impl ConditionalFormatting { } } impl AdjustmentCoordinate for ConditionalFormatting { + #[inline] fn adjustment_insert_coordinate( &mut self, root_col_num: &u32, @@ -128,6 +136,7 @@ impl AdjustmentCoordinate for ConditionalFormatting { ); } + #[inline] fn adjustment_remove_coordinate( &mut self, root_col_num: &u32, @@ -143,6 +152,7 @@ impl AdjustmentCoordinate for ConditionalFormatting { ); } + #[inline] fn is_remove_coordinate( &self, root_col_num: &u32, diff --git a/src/structs/conditional_formatting_operator_values.rs b/src/structs/conditional_formatting_operator_values.rs index c163978e..0e135251 100644 --- a/src/structs/conditional_formatting_operator_values.rs +++ b/src/structs/conditional_formatting_operator_values.rs @@ -16,11 +16,13 @@ pub enum ConditionalFormattingOperatorValues { NotEqual, } impl Default for ConditionalFormattingOperatorValues { + #[inline] fn default() -> Self { Self::LessThan } } impl EnumTrait for ConditionalFormattingOperatorValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::BeginsWith => "beginsWith", @@ -40,6 +42,8 @@ impl EnumTrait for ConditionalFormattingOperatorValues { } impl FromStr for ConditionalFormattingOperatorValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "beginsWith" => Ok(Self::BeginsWith), diff --git a/src/structs/conditional_formatting_rule.rs b/src/structs/conditional_formatting_rule.rs index aa37da0e..d1cc6282 100644 --- a/src/structs/conditional_formatting_rule.rs +++ b/src/structs/conditional_formatting_rule.rs @@ -42,179 +42,218 @@ pub struct ConditionalFormattingRule { } impl ConditionalFormattingRule { + #[inline] pub fn get_type(&self) -> &ConditionalFormatValues { self.r#type.get_value() } + #[inline] pub fn set_type(&mut self, value: ConditionalFormatValues) -> &mut Self { self.r#type.set_value(value); self } + #[inline] pub fn get_operator(&self) -> &ConditionalFormattingOperatorValues { self.operator.get_value() } + #[inline] pub fn set_operator(&mut self, value: ConditionalFormattingOperatorValues) -> &mut Self { self.operator.set_value(value); self } + #[inline] pub fn get_text(&self) -> &str { self.text.get_value_str() } + #[inline] pub fn set_text>(&mut self, value: S) -> &mut Self { self.text.set_value(value.into()); self } + #[inline] pub fn get_priority(&self) -> &i32 { self.priority.get_value() } + #[inline] pub fn set_priority(&mut self, value: i32) -> &mut Self { self.priority.set_value(value); self } + #[inline] pub fn get_percent(&self) -> &bool { self.percent.get_value() } + #[inline] pub fn set_percent(&mut self, value: bool) -> &mut Self { self.percent.set_value(value); self } + #[inline] pub fn get_bottom(&self) -> &bool { self.bottom.get_value() } + #[inline] pub fn set_bottom(&mut self, value: bool) -> &mut Self { self.bottom.set_value(value); self } + #[inline] pub fn get_rank(&self) -> &u32 { self.rank.get_value() } + #[inline] pub fn set_rank(&mut self, value: u32) -> &mut Self { self.rank.set_value(value); self } + #[inline] pub fn get_stop_if_true(&self) -> &bool { self.stop_if_true.get_value() } + #[inline] pub fn set_stop_if_true(&mut self, value: bool) -> &mut Self { self.stop_if_true.set_value(value); self } + #[inline] pub fn get_std_dev(&self) -> &i32 { self.std_dev.get_value() } + #[inline] pub fn set_std_dev(&mut self, value: i32) -> &mut Self { self.std_dev.set_value(value); self } + #[inline] pub fn get_above_average(&self) -> &bool { self.above_average.get_value() } + #[inline] pub fn set_above_average(&mut self, value: bool) -> &mut Self { self.above_average.set_value(value); self } + #[inline] pub fn get_equal_average(&self) -> &bool { self.equal_average.get_value() } + #[inline] pub fn set_equal_average(&mut self, value: bool) -> &mut Self { self.equal_average.set_value(value); self } + #[inline] pub fn get_time_period(&self) -> &TimePeriodValues { self.time_period.get_value() } + #[inline] pub fn set_time_period(&mut self, value: TimePeriodValues) -> &mut Self { self.time_period.set_value(value); self } + #[inline] pub fn get_style(&self) -> Option<&Style> { self.style.as_deref() } + #[inline] pub fn set_style(&mut self, value: Style) -> &mut Self { self.style = Some(Box::new(value)); self } + #[inline] pub fn remove_style(&mut self) -> &mut Self { self.style = None; self } + #[inline] pub fn get_color_scale(&self) -> Option<&ColorScale> { self.color_scale.as_ref() } + #[inline] pub fn set_color_scale(&mut self, value: ColorScale) -> &mut Self { self.color_scale = Some(value); self } + #[inline] pub fn remove_color_scale(&mut self) -> &mut Self { self.color_scale = None; self } + #[inline] pub fn get_data_bar(&self) -> Option<&DataBar> { self.data_bar.as_ref() } + #[inline] pub fn set_data_bar(&mut self, value: DataBar) -> &mut Self { self.data_bar = Some(value); self } + #[inline] pub fn remove_data_bar(&mut self) -> &mut Self { self.data_bar = None; self } + #[inline] pub fn get_icon_set(&self) -> Option<&IconSet> { self.icon_set.as_ref() } + #[inline] pub fn set_icon_set(&mut self, value: IconSet) -> &mut Self { self.icon_set = Some(value); self } + #[inline] pub fn remove_icon_set(&mut self) -> &mut Self { self.icon_set = None; self } + #[inline] pub fn get_formula(&self) -> Option<&Formula> { self.formula.as_deref() } + #[inline] pub fn set_formula(&mut self, value: Formula) -> &mut Self { self.formula = Some(Box::new(value)); self } + #[inline] pub fn remove_formula(&mut self) -> &mut Self { self.formula = None; self diff --git a/src/structs/coordinate.rs b/src/structs/coordinate.rs index 68284cbc..d48a4d9d 100644 --- a/src/structs/coordinate.rs +++ b/src/structs/coordinate.rs @@ -11,6 +11,7 @@ pub struct Coordinate { } impl ToString for Coordinate { + #[inline] fn to_string(&self) -> String { coordinate_from_index_with_lock( self.column.get_num(), @@ -22,47 +23,57 @@ impl ToString for Coordinate { } impl Coordinate { + #[inline] pub fn get_col_num(&self) -> &u32 { self.column.get_num() } + #[inline] pub fn set_col_num(&mut self, value: u32) -> &mut Self { self.column.set_num(value); self } + #[inline] pub(crate) fn offset_col_num(&mut self, value: i32) -> &mut Self { self.column.offset_num(value); self } + #[inline] pub fn get_row_num(&self) -> &u32 { self.row.get_num() } + #[inline] pub fn set_row_num(&mut self, value: u32) -> &mut Self { self.row.set_num(value); self } + #[inline] pub(crate) fn offset_row_num(&mut self, value: i32) -> &mut Self { self.row.offset_num(value); self } + #[inline] pub fn get_is_lock_col(&self) -> &bool { self.column.get_is_lock() } + #[inline] pub fn set_is_lock_col(&mut self, value: bool) -> &mut Self { self.column.set_is_lock(value); self } + #[inline] pub fn get_is_lock_row(&self) -> &bool { self.row.get_is_lock() } + #[inline] pub fn set_is_lock_row(&mut self, value: bool) -> &mut Self { self.row.set_is_lock(value); self @@ -70,6 +81,7 @@ impl Coordinate { /// Change coordinates /// Formula is not updated. + #[inline] pub fn set_coordinate>(&mut self, value: S) -> &mut Self { let (c, r, cl, rl) = index_from_coordinate(value.as_ref()); @@ -81,6 +93,7 @@ impl Coordinate { self } + #[inline] pub fn get_coordinate(&self) -> String { coordinate_from_index_with_lock( self.column.get_num(), @@ -91,6 +104,7 @@ impl Coordinate { } } impl AdjustmentCoordinate for Coordinate { + #[inline] fn adjustment_insert_coordinate( &mut self, root_col_num: &u32, @@ -104,6 +118,7 @@ impl AdjustmentCoordinate for Coordinate { .adjustment_insert_value(root_row_num, offset_row_num); } + #[inline] fn adjustment_remove_coordinate( &mut self, root_col_num: &u32, @@ -117,6 +132,7 @@ impl AdjustmentCoordinate for Coordinate { .adjustment_remove_value(root_row_num, offset_row_num); } + #[inline] fn is_remove_coordinate( &self, root_col_num: &u32, diff --git a/src/structs/csv_encode_values.rs b/src/structs/csv_encode_values.rs index bdaca358..ebfaa22d 100644 --- a/src/structs/csv_encode_values.rs +++ b/src/structs/csv_encode_values.rs @@ -14,11 +14,13 @@ pub enum CsvEncodeValues { Utf16Be, } impl Default for CsvEncodeValues { + #[inline] fn default() -> Self { Self::Utf8 } } impl EnumTrait for CsvEncodeValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::Utf8 => "utf_8", @@ -36,6 +38,8 @@ impl EnumTrait for CsvEncodeValues { } impl FromStr for CsvEncodeValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "utf_8" => Ok(Self::Utf8), diff --git a/src/structs/csv_writer_option.rs b/src/structs/csv_writer_option.rs index a77596bc..dea8e09a 100644 --- a/src/structs/csv_writer_option.rs +++ b/src/structs/csv_writer_option.rs @@ -8,28 +8,34 @@ pub struct CsvWriterOption { pub(crate) do_trim: bool, } impl CsvWriterOption { + #[inline] pub fn get_csv_encode_value(&self) -> &CsvEncodeValues { self.csv_encode_values.get_value() } + #[inline] pub fn set_csv_encode_value(&mut self, value: CsvEncodeValues) -> &mut Self { self.csv_encode_values.set_value(value); self } + #[inline] pub fn get_wrap_with_char(&self) -> &str { &self.wrap_with_char } + #[inline] pub fn set_wrap_with_char>(&mut self, value: S) -> &mut Self { self.wrap_with_char = value.into().into_boxed_str(); self } + #[inline] pub fn get_do_trim(&self) -> &bool { &self.do_trim } + #[inline] pub fn set_do_trim(&mut self, value: bool) -> &mut Self { self.do_trim = value; self diff --git a/src/structs/custom_properties/custom_document_property.rs b/src/structs/custom_properties/custom_document_property.rs index a6555b31..ae23f655 100644 --- a/src/structs/custom_properties/custom_document_property.rs +++ b/src/structs/custom_properties/custom_document_property.rs @@ -17,42 +17,51 @@ pub struct CustomDocumentProperty { } impl CustomDocumentProperty { + #[inline] pub fn get_name(&self) -> &str { self.name.get_value_str() } + #[inline] pub fn set_name>(&mut self, value: S) -> &mut Self { self.name.set_value(value); self } + #[inline] pub fn get_link_target(&self) -> &str { self.link_target.get_value_str() } + #[inline] pub fn set_link_target>(&mut self, value: S) -> &mut Self { self.link_target.set_value(value); self } + #[inline] pub fn get_value(&self) -> Cow<'static, str> { self.custom_document_property_value.to_string().into() } + #[inline] pub fn get_value_number(&self) -> Option { self.custom_document_property_value.get_number() } + #[inline] pub fn get_value_bool(&self) -> Option { self.custom_document_property_value.get_bool() } + #[inline] pub fn set_value_string>(&mut self, value: S) -> &mut Self { self.custom_document_property_value = CustomDocumentPropertyValue::String(value.into().into_boxed_str()); self } + #[inline] pub fn set_value_number(&mut self, value: T) -> &mut Self where T: Into, @@ -61,6 +70,7 @@ impl CustomDocumentProperty { self } + #[inline] pub fn set_value_date(&mut self, year: i32, month: i32, day: i32) -> &mut Self { let value = format!("{:>04}-{:>02}-{:>02}T10:00:00Z", year, month, day); self.custom_document_property_value = @@ -68,12 +78,14 @@ impl CustomDocumentProperty { self } + #[inline] pub fn set_value_date_manual>(&mut self, value: S) -> &mut Self { self.custom_document_property_value = CustomDocumentPropertyValue::Date(value.into().into_boxed_str()); self } + #[inline] pub fn set_value_bool(&mut self, value: bool) -> &mut Self { self.custom_document_property_value = CustomDocumentPropertyValue::Bool(value); self diff --git a/src/structs/custom_properties/custom_document_property_value.rs b/src/structs/custom_properties/custom_document_property_value.rs index c9ae9db7..ef42a7b0 100644 --- a/src/structs/custom_properties/custom_document_property_value.rs +++ b/src/structs/custom_properties/custom_document_property_value.rs @@ -9,6 +9,7 @@ pub enum CustomDocumentPropertyValue { Null, } impl fmt::Display for CustomDocumentPropertyValue { + #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Self::String(v) => write!(f, "{}", v), @@ -20,11 +21,13 @@ impl fmt::Display for CustomDocumentPropertyValue { } } impl Default for CustomDocumentPropertyValue { + #[inline] fn default() -> Self { Self::Null } } impl CustomDocumentPropertyValue { + #[inline] pub(crate) fn get_tag(&self) -> Option<&str> { match self { Self::String(_) => Some("vt:lpwstr"), @@ -35,6 +38,7 @@ impl CustomDocumentPropertyValue { } } + #[inline] pub(crate) fn get_number(&self) -> Option { match self { Self::Numeric(number) => Some(*number), @@ -42,6 +46,7 @@ impl CustomDocumentPropertyValue { } } + #[inline] pub(crate) fn get_bool(&self) -> Option { match self { Self::Bool(bool) => Some(*bool), diff --git a/src/structs/custom_properties/properties.rs b/src/structs/custom_properties/properties.rs index 0c9fa3d3..3d5a5cea 100644 --- a/src/structs/custom_properties/properties.rs +++ b/src/structs/custom_properties/properties.rs @@ -16,16 +16,19 @@ pub struct Properties { } impl Properties { + #[inline] pub fn get_custom_document_property_list(&self) -> &[CustomDocumentProperty] { &self.custom_document_property_list } + #[inline] pub fn get_custom_document_property_list_mut( &mut self, ) -> &mut ThinVec { &mut self.custom_document_property_list } + #[inline] pub fn set_custom_document_property_list( &mut self, value: impl Into>, @@ -34,6 +37,7 @@ impl Properties { self } + #[inline] pub fn add_custom_document_property_list( &mut self, value: CustomDocumentProperty, @@ -42,6 +46,7 @@ impl Properties { self } + #[inline] pub fn remove_custom_document_property_list( &mut self, value: CustomDocumentProperty, diff --git a/src/structs/data_bar.rs b/src/structs/data_bar.rs index 62ded6f3..f5291906 100644 --- a/src/structs/data_bar.rs +++ b/src/structs/data_bar.rs @@ -16,10 +16,12 @@ pub struct DataBar { } impl DataBar { + #[inline] pub fn get_cfvo_collection(&self) -> &[ConditionalFormatValueObject] { &self.cfvo_collection } + #[inline] pub fn set_cfvo_collection( &mut self, value: ThinVec, @@ -28,20 +30,24 @@ impl DataBar { self } + #[inline] pub fn add_cfvo_collection(&mut self, value: ConditionalFormatValueObject) -> &mut Self { self.cfvo_collection.push(value); self } + #[inline] pub fn get_color_collection(&self) -> &[Color] { &self.color_collection } + #[inline] pub fn set_color_collection(&mut self, value: impl Into>) -> &mut Self { self.color_collection = value.into(); self } + #[inline] pub fn add_color_collection(&mut self, value: Color) -> &mut Self { self.color_collection.push(value); self diff --git a/src/structs/data_validation.rs b/src/structs/data_validation.rs index c6f40da6..ebfccbe2 100644 --- a/src/structs/data_validation.rs +++ b/src/structs/data_validation.rs @@ -27,95 +27,116 @@ pub struct DataValidation { formula2: StringValue, } impl DataValidation { + #[inline] pub fn get_type(&self) -> &DataValidationValues { self.r#type.get_value() } + #[inline] pub fn set_type(&mut self, value: DataValidationValues) -> &mut Self { self.r#type.set_value(value); self } + #[inline] pub fn get_operator(&self) -> &DataValidationOperatorValues { self.operator.get_value() } + #[inline] pub fn set_operator(&mut self, value: DataValidationOperatorValues) -> &mut Self { self.operator.set_value(value); self } + #[inline] pub fn get_allow_blank(&self) -> &bool { self.allow_blank.get_value() } + #[inline] pub fn set_allow_blank(&mut self, value: bool) -> &mut Self { self.allow_blank.set_value(value); self } + #[inline] pub fn get_show_input_message(&self) -> &bool { self.show_input_message.get_value() } + #[inline] pub fn set_show_input_message(&mut self, value: bool) -> &mut Self { self.show_input_message.set_value(value); self } + #[inline] pub fn get_show_error_message(&self) -> &bool { self.show_error_message.get_value() } + #[inline] pub fn set_show_error_message(&mut self, value: bool) -> &mut Self { self.show_error_message.set_value(value); self } + #[inline] pub fn get_prompt_title(&self) -> &str { self.prompt_title.get_value_str() } + #[inline] pub fn set_prompt_title>(&mut self, value: S) -> &mut Self { self.prompt_title.set_value(value); self } + #[inline] pub fn get_prompt(&self) -> &str { self.prompt.get_value_str() } + #[inline] pub fn set_prompt>(&mut self, value: S) -> &mut Self { self.prompt.set_value(value); self } + #[inline] pub fn get_sequence_of_references(&self) -> &SequenceOfReferences { &self.sequence_of_references } + #[inline] pub fn get_sequence_of_references_mut(&mut self) -> &mut SequenceOfReferences { &mut self.sequence_of_references } + #[inline] pub fn set_sequence_of_references(&mut self, value: SequenceOfReferences) -> &mut Self { self.sequence_of_references = value; self } + #[inline] pub fn get_formula1(&self) -> &str { self.formula1.get_value_str() } + #[inline] pub fn set_formula1>(&mut self, value: S) -> &mut Self { self.formula1.set_value(value); self } + #[inline] pub fn get_formula2(&self) -> &str { self.formula2.get_value_str() } + #[inline] pub fn set_formula2>(&mut self, value: S) -> &mut Self { self.formula2.set_value(value); self diff --git a/src/structs/data_validation_operator_values.rs b/src/structs/data_validation_operator_values.rs index 6ad2e9c4..3357cdeb 100644 --- a/src/structs/data_validation_operator_values.rs +++ b/src/structs/data_validation_operator_values.rs @@ -14,6 +14,7 @@ pub enum DataValidationOperatorValues { } impl EnumTrait for DataValidationOperatorValues { + #[inline] fn get_value_string(&self) -> &str { match self { Self::Between => "between", @@ -29,6 +30,7 @@ impl EnumTrait for DataValidationOperatorValues { } impl Default for DataValidationOperatorValues { + #[inline] fn default() -> Self { Self::LessThan } @@ -37,6 +39,7 @@ impl Default for DataValidationOperatorValues { impl FromStr for DataValidationOperatorValues { type Err = (); + #[inline] fn from_str(input: &str) -> Result { Ok(match input { "between" => Self::Between, diff --git a/src/structs/data_validation_values.rs b/src/structs/data_validation_values.rs index 72ee1ad6..1fd5a388 100644 --- a/src/structs/data_validation_values.rs +++ b/src/structs/data_validation_values.rs @@ -12,11 +12,13 @@ pub enum DataValidationValues { Whole, } impl Default for DataValidationValues { + #[inline] fn default() -> Self { Self::None } } impl EnumTrait for DataValidationValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::Custom => "custom", @@ -32,6 +34,8 @@ impl EnumTrait for DataValidationValues { } impl FromStr for DataValidationValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "custom" => Ok(Self::Custom), diff --git a/src/structs/data_validations.rs b/src/structs/data_validations.rs index b4a0e737..6b736d0c 100644 --- a/src/structs/data_validations.rs +++ b/src/structs/data_validations.rs @@ -14,14 +14,17 @@ pub struct DataValidations { } impl DataValidations { + #[inline] pub fn get_data_validation_list(&self) -> &[DataValidation] { &self.data_validation_list } + #[inline] pub fn get_data_validation_list_mut(&mut self) -> &mut ThinVec { &mut self.data_validation_list } + #[inline] pub fn set_data_validation_list( &mut self, value: impl Into>, @@ -30,6 +33,7 @@ impl DataValidations { self } + #[inline] pub fn add_data_validation_list(&mut self, value: DataValidation) -> &mut Self { self.data_validation_list.push(value); self diff --git a/src/structs/defined_name.rs b/src/structs/defined_name.rs index 32f9acf8..3e4bd461 100644 --- a/src/structs/defined_name.rs +++ b/src/structs/defined_name.rs @@ -21,10 +21,12 @@ pub struct DefinedName { hidden: BooleanValue, } impl DefinedName { + #[inline] pub fn get_name(&self) -> &str { &self.name.get_value_str() } + #[inline] pub(crate) fn set_name>(&mut self, value: S) -> &mut Self { self.name.set_value(value); self @@ -73,36 +75,44 @@ impl DefinedName { .to_string() } + #[inline] pub(crate) fn get_address_obj(&self) -> &[Address] { &self.address } + #[inline] pub(crate) fn get_address_obj_mut(&mut self) -> &mut ThinVec
{ &mut self.address } + #[inline] pub(crate) fn set_string_value>(&mut self, value: S) -> &mut Self { self.address.clear(); self.string_value.set_value(value); self } + #[inline] pub fn has_local_sheet_id(&self) -> bool { self.local_sheet_id.has_value() } + #[inline] pub fn get_local_sheet_id(&self) -> &u32 { &self.local_sheet_id.get_value() } + #[inline] pub fn set_local_sheet_id(&mut self, value: u32) { self.local_sheet_id.set_value(value); } + #[inline] pub fn get_hidden(&self) -> &bool { &self.hidden.get_value() } + #[inline] pub fn set_hidden(&mut self, value: bool) { self.hidden.set_value(value); } @@ -251,6 +261,7 @@ impl AdjustmentCoordinateWithSheet for DefinedName { } } + #[inline] fn is_remove_coordinate_with_sheet( &self, sheet_name: &str, diff --git a/src/structs/diagonal_border.rs b/src/structs/diagonal_border.rs index e44e6732..07fd0949 100644 --- a/src/structs/diagonal_border.rs +++ b/src/structs/diagonal_border.rs @@ -14,23 +14,28 @@ pub struct DiagonalBorder { style: EnumValue, } impl DiagonalBorder { + #[inline] pub fn get_color(&self) -> &Color { &self.color } + #[inline] pub fn get_color_mut(&mut self) -> &mut Color { &mut self.color } + #[inline] pub fn set_color(&mut self, value: Color) -> &mut Self { self.color = value; self } + #[inline] pub fn get_style(&self) -> &BorderStyleValues { self.style.get_value() } + #[inline] pub fn set_style(&mut self, value: BorderStyleValues) -> &mut Self { self.style.set_value(value); self @@ -52,13 +57,16 @@ impl DiagonalBorder { pub const BORDER_THICK: &'static str = "thick"; pub const BORDER_THIN: &'static str = "thin"; + #[inline] pub fn get_border_style(&self) -> &str { &self.style.get_value_string() } + #[inline] pub fn set_border_style>(&mut self, value: S) { self.style.set_value_string(value); } + #[inline] pub(crate) fn get_hash_code(&self) -> String { format!( "{:x}", @@ -100,6 +108,7 @@ impl DiagonalBorder { } } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { let empty_flag = !self.color.has_value(); diff --git a/src/structs/differential_format.rs b/src/structs/differential_format.rs index 47b5fe56..b497cb8c 100644 --- a/src/structs/differential_format.rs +++ b/src/structs/differential_format.rs @@ -21,58 +21,71 @@ pub(crate) struct DifferentialFormat { } impl DifferentialFormat { + #[inline] pub(crate) fn _get_font(&self) -> Option<&Font> { self.font.as_deref() } + #[inline] pub(crate) fn _get_font_mut(&mut self) -> Option<&mut Font> { self.font.as_deref_mut() } + #[inline] pub(crate) fn set_font(&mut self, value: Font) -> &mut Self { self.font = Some(Box::new(value)); self } + #[inline] pub(crate) fn _get_fill(&self) -> Option<&Fill> { self.fill.as_ref() } + #[inline] pub(crate) fn _get_fill_mut(&mut self) -> Option<&mut Fill> { self.fill.as_mut() } + #[inline] pub(crate) fn set_fill(&mut self, value: Fill) -> &mut Self { self.fill = Some(value); self } + #[inline] pub(crate) fn _get_borders(&self) -> Option<&Borders> { self.borders.as_deref() } + #[inline] pub(crate) fn _get_borders_mut(&mut self) -> Option<&mut Borders> { self.borders.as_deref_mut() } + #[inline] pub(crate) fn set_borders(&mut self, value: Borders) -> &mut Self { self.borders = Some(Box::new(value)); self } + #[inline] pub(crate) fn _get_alignment(&self) -> Option<&Alignment> { self.alignment.as_ref() } + #[inline] pub(crate) fn _get_alignment_mut(&mut self) -> Option<&mut Alignment> { self.alignment.as_mut() } + #[inline] pub(crate) fn set_alignment(&mut self, value: Alignment) -> &mut Self { self.alignment = Some(value); self } + #[inline] pub(crate) fn get_style(&self) -> Style { let mut style = Style::default(); style.set_font_crate(self.font.as_deref().cloned()); @@ -82,6 +95,7 @@ impl DifferentialFormat { style } + #[inline] pub(crate) fn set_style(&mut self, style: &Style) { self.font = style.get_font().cloned().map(Box::new); self.fill = style.get_fill().cloned(); diff --git a/src/structs/differential_formats.rs b/src/structs/differential_formats.rs index 8d67784d..0e63066f 100644 --- a/src/structs/differential_formats.rs +++ b/src/structs/differential_formats.rs @@ -15,19 +15,23 @@ pub(crate) struct DifferentialFormats { } impl DifferentialFormats { + #[inline] pub(crate) fn _get_differential_format(&self) -> &[DifferentialFormat] { &self.differential_format } + #[inline] pub(crate) fn _get_differential_format_mut(&mut self) -> &mut ThinVec { &mut self.differential_format } + #[inline] pub(crate) fn set_differential_format(&mut self, value: DifferentialFormat) -> &mut Self { self.differential_format.push(value); self } + #[inline] pub(crate) fn get_style(&self, id: usize) -> Style { let differential_format = self.differential_format.get(id).unwrap().clone(); differential_format.get_style() diff --git a/src/structs/double_value.rs b/src/structs/double_value.rs index ff0c591f..d1607310 100644 --- a/src/structs/double_value.rs +++ b/src/structs/double_value.rs @@ -3,6 +3,7 @@ pub struct DoubleValue { value: Option, } impl DoubleValue { + #[inline] pub(crate) fn get_value(&self) -> &f64 { match &self.value { Some(v) => v, @@ -10,23 +11,28 @@ impl DoubleValue { } } + #[inline] pub(crate) fn get_value_string(&self) -> String { self.get_value().to_string() } + #[inline] pub(crate) fn set_value(&mut self, value: f64) -> &mut Self { self.value = Some(value); self } + #[inline] pub(crate) fn set_value_string>(&mut self, value: S) -> &mut Self { self.set_value(value.into().parse::().unwrap_or_default()) } + #[inline] pub(crate) fn has_value(&self) -> bool { self.value.is_some() } + #[inline] pub(crate) fn get_hash_string(&self) -> String { if self.has_value() { return self.get_value_string(); diff --git a/src/structs/drawing/adjust_value_list.rs b/src/structs/drawing/adjust_value_list.rs index 64781cdf..6f3102ae 100644 --- a/src/structs/drawing/adjust_value_list.rs +++ b/src/structs/drawing/adjust_value_list.rs @@ -14,18 +14,22 @@ pub struct AdjustValueList { } impl AdjustValueList { + #[inline] pub fn get_shape_guide_collection(&self) -> &[ShapeGuide] { &self.shape_guide_collection } + #[inline] pub fn get_shape_guide_collection_mut(&mut self) -> &mut ThinVec { &mut self.shape_guide_collection } + #[inline] pub fn set_shape_guide_collection(&mut self, value: impl Into>) { self.shape_guide_collection = value.into(); } + #[inline] pub fn add_shape_guide_collection(&mut self, value: ShapeGuide) { self.shape_guide_collection.push(value); } diff --git a/src/structs/drawing/alpha.rs b/src/structs/drawing/alpha.rs index 47f67875..d14c05b7 100644 --- a/src/structs/drawing/alpha.rs +++ b/src/structs/drawing/alpha.rs @@ -11,14 +11,17 @@ pub struct Alpha { val: Box, } impl Alpha { + #[inline] pub fn get_val(&self) -> &str { &self.val } + #[inline] pub fn set_val>(&mut self, value: S) { self.val = value.into().into_boxed_str(); } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -27,6 +30,7 @@ impl Alpha { self.set_val(get_attribute(e, b"val").unwrap()); } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { // a:alpha write_start_tag(writer, "a:alpha", vec![("val", &self.val)], true); diff --git a/src/structs/drawing/background_color.rs b/src/structs/drawing/background_color.rs index 34f8ee1e..122d3ea3 100644 --- a/src/structs/drawing/background_color.rs +++ b/src/structs/drawing/background_color.rs @@ -13,14 +13,17 @@ pub struct BackgroundColor { } impl BackgroundColor { + #[inline] pub fn get_scheme_color(&self) -> &SchemeColor { &self.scheme_color } + #[inline] pub fn get_scheme_color_mut(&mut self) -> &mut SchemeColor { &mut self.scheme_color } + #[inline] pub fn set_scheme_color(&mut self, value: SchemeColor) -> &mut BackgroundColor { self.scheme_color = value; self diff --git a/src/structs/drawing/background_fill_style_list.rs b/src/structs/drawing/background_fill_style_list.rs index 342c6934..dafcdc34 100644 --- a/src/structs/drawing/background_fill_style_list.rs +++ b/src/structs/drawing/background_fill_style_list.rs @@ -15,32 +15,39 @@ pub struct BackgroundFillStyleList { } impl BackgroundFillStyleList { + #[inline] pub fn get_solid_fill(&self) -> &[SolidFill] { &self.solid_fill } + #[inline] pub fn get_solid_fill_mut(&mut self) -> &mut ThinVec { &mut self.solid_fill } + #[inline] pub fn set_solid_fill(&mut self, value: impl Into>) -> &mut Self { self.solid_fill = value.into(); self } + #[inline] pub fn add_solid_fill(&mut self, value: SolidFill) -> &mut Self { self.solid_fill.push(value); self } + #[inline] pub fn get_gradient_fill_collection(&self) -> &[GradientFill] { &self.gradient_fill_collection } + #[inline] pub fn get_gradient_fill_collectionl_mut(&mut self) -> &mut ThinVec { &mut self.gradient_fill_collection } + #[inline] pub fn set_gradient_fill_collection( &mut self, value: impl Into>, @@ -49,6 +56,7 @@ impl BackgroundFillStyleList { self } + #[inline] pub fn add_gradient_fill_collection(&mut self, value: GradientFill) -> &mut Self { self.gradient_fill_collection.push(value); self diff --git a/src/structs/drawing/bevel.rs b/src/structs/drawing/bevel.rs index 5f7ce257..d3881022 100644 --- a/src/structs/drawing/bevel.rs +++ b/src/structs/drawing/bevel.rs @@ -8,6 +8,7 @@ use writer::driver::*; #[derive(Clone, Default, Debug)] pub struct Bevel {} impl Bevel { + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -15,6 +16,7 @@ impl Bevel { ) { } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { // a:bevel write_start_tag(writer, "a:bevel", vec![], true); diff --git a/src/structs/drawing/bevel_bottom.rs b/src/structs/drawing/bevel_bottom.rs index 500cefba..2f3235d8 100644 --- a/src/structs/drawing/bevel_bottom.rs +++ b/src/structs/drawing/bevel_bottom.rs @@ -17,33 +17,40 @@ pub struct BevelBottom { } impl BevelBottom { + #[inline] pub fn get_width(&self) -> &i64 { self.width.get_value() } + #[inline] pub fn set_width(&mut self, value: i64) -> &mut BevelBottom { self.width.set_value(value); self } + #[inline] pub fn get_height(&self) -> &i64 { self.height.get_value() } + #[inline] pub fn set_height(&mut self, value: i64) -> &mut BevelBottom { self.height.set_value(value); self } + #[inline] pub fn get_preset(&self) -> &BevelPresetValues { self.preset.get_value() } + #[inline] pub fn set_preset(&mut self, value: BevelPresetValues) -> &mut BevelBottom { self.preset.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, diff --git a/src/structs/drawing/bevel_preset_values.rs b/src/structs/drawing/bevel_preset_values.rs index 42d0aab6..487a1318 100644 --- a/src/structs/drawing/bevel_preset_values.rs +++ b/src/structs/drawing/bevel_preset_values.rs @@ -16,11 +16,13 @@ pub enum BevelPresetValues { SoftRound, } impl Default for BevelPresetValues { + #[inline] fn default() -> Self { Self::RelaxedInset } } impl EnumTrait for BevelPresetValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::Angle => "angle", @@ -40,6 +42,8 @@ impl EnumTrait for BevelPresetValues { } impl FromStr for BevelPresetValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "angle" => Ok(Self::Angle), diff --git a/src/structs/drawing/bevel_top.rs b/src/structs/drawing/bevel_top.rs index 72c702e0..f3a12ea1 100644 --- a/src/structs/drawing/bevel_top.rs +++ b/src/structs/drawing/bevel_top.rs @@ -17,33 +17,40 @@ pub struct BevelTop { } impl BevelTop { + #[inline] pub fn get_width(&self) -> &i64 { self.width.get_value() } + #[inline] pub fn set_width(&mut self, value: i64) -> &mut BevelTop { self.width.set_value(value); self } + #[inline] pub fn get_height(&self) -> &i64 { self.height.get_value() } + #[inline] pub fn set_height(&mut self, value: i64) -> &mut BevelTop { self.height.set_value(value); self } + #[inline] pub fn get_preset(&self) -> &BevelPresetValues { self.preset.get_value() } + #[inline] pub fn set_preset(&mut self, value: BevelPresetValues) -> &mut BevelTop { self.preset.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, diff --git a/src/structs/drawing/blip.rs b/src/structs/drawing/blip.rs index 9493a850..7c4d2ff1 100644 --- a/src/structs/drawing/blip.rs +++ b/src/structs/drawing/blip.rs @@ -16,23 +16,28 @@ pub struct Blip { } impl Blip { + #[inline] pub fn get_image(&self) -> &MediaObject { &self.image } + #[inline] pub fn get_image_mut(&mut self) -> &mut MediaObject { &mut self.image } + #[inline] pub fn set_image(&mut self, value: MediaObject) -> &mut Self { self.image = value; self } + #[inline] pub fn get_cstate(&self) -> &str { &self.cstate } + #[inline] pub fn set_cstate>(&mut self, value: S) -> &mut Self { self.cstate = value.into().into_boxed_str(); self diff --git a/src/structs/drawing/blip_fill.rs b/src/structs/drawing/blip_fill.rs index 114d6e94..6ca73933 100644 --- a/src/structs/drawing/blip_fill.rs +++ b/src/structs/drawing/blip_fill.rs @@ -20,49 +20,60 @@ pub struct BlipFill { } impl BlipFill { + #[inline] pub fn get_rotate_with_shape(&self) -> &bool { self.rotate_with_shape.get_value() } + #[inline] pub fn set_rotate_with_shape(&mut self, value: bool) -> &mut BlipFill { self.rotate_with_shape.set_value(value); self } + #[inline] pub fn get_source_rectangle(&self) -> Option<&SourceRectangle> { self.source_rectangle.as_deref() } + #[inline] pub fn get_source_rectangle_mut(&mut self) -> Option<&mut SourceRectangle> { self.source_rectangle.as_deref_mut() } + #[inline] pub fn set_source_rectangle(&mut self, value: SourceRectangle) -> &mut BlipFill { self.source_rectangle = Some(Box::new(value)); self } + #[inline] pub fn get_blip(&self) -> &Blip { &self.blip } + #[inline] pub fn get_blip_mut(&mut self) -> &mut Blip { &mut self.blip } + #[inline] pub fn set_blip(&mut self, value: Blip) -> &mut BlipFill { self.blip = value; self } + #[inline] pub fn get_stretch(&self) -> &Stretch { &self.stretch } + #[inline] pub fn get_stretch_mut(&mut self) -> &mut Stretch { &mut self.stretch } + #[inline] pub fn set_stretch(&mut self, value: Stretch) -> &mut BlipFill { self.stretch = value; self diff --git a/src/structs/drawing/body_properties.rs b/src/structs/drawing/body_properties.rs index ebe07100..2197015d 100644 --- a/src/structs/drawing/body_properties.rs +++ b/src/structs/drawing/body_properties.rs @@ -26,87 +26,107 @@ pub struct BodyProperties { } impl BodyProperties { + #[inline] pub fn get_vert_overflow(&self) -> Option<&str> { self.vert_overflow.get_value() } + #[inline] pub fn set_vert_overflow>(&mut self, value: S) -> &mut BodyProperties { self.vert_overflow.set_value(value); self } + #[inline] pub fn get_horz_overflow(&self) -> Option<&str> { self.horz_overflow.get_value() } + #[inline] pub fn set_horz_overflow>(&mut self, value: S) -> &mut BodyProperties { self.horz_overflow.set_value(value); self } + #[inline] pub fn get_rtl_col(&self) -> Option<&str> { self.rtl_col.get_value() } + #[inline] pub fn set_rtl_col>(&mut self, value: S) -> &mut BodyProperties { self.rtl_col.set_value(value); self } + #[inline] pub fn get_anchor(&self) -> Option<&str> { self.anchor.get_value() } + #[inline] pub fn set_anchor>(&mut self, value: S) -> &mut BodyProperties { self.anchor.set_value(value); self } + #[inline] pub fn get_wrap(&self) -> &TextWrappingValues { self.wrap.get_value() } + #[inline] pub fn set_wrap(&mut self, value: TextWrappingValues) -> &mut BodyProperties { self.wrap.set_value(value); self } + #[inline] pub fn get_left_inset(&self) -> &i32 { self.left_inset.get_value() } + #[inline] pub fn set_left_inset(&mut self, value: i32) { self.left_inset.set_value(value); } + #[inline] pub fn get_top_inset(&self) -> &i32 { self.top_inset.get_value() } + #[inline] pub fn set_top_inset(&mut self, value: i32) { self.top_inset.set_value(value); } + #[inline] pub fn get_right_inset(&self) -> &i32 { self.right_inset.get_value() } + #[inline] pub fn set_right_inset(&mut self, value: i32) { self.right_inset.set_value(value); } + #[inline] pub fn get_bottom_inset(&self) -> &i32 { self.bottom_inset.get_value() } + #[inline] pub fn set_bottom_inset(&mut self, value: i32) { self.bottom_inset.set_value(value); } + #[inline] pub fn get_shape_auto_fit(&self) -> Option<&ShapeAutoFit> { self.shape_auto_fit.as_ref() } + #[inline] pub fn set_shape_auto_fit(&mut self, value: ShapeAutoFit) -> &mut BodyProperties { self.shape_auto_fit = Some(value); self diff --git a/src/structs/drawing/camera.rs b/src/structs/drawing/camera.rs index dc63fa0f..566fc0e9 100644 --- a/src/structs/drawing/camera.rs +++ b/src/structs/drawing/camera.rs @@ -16,23 +16,28 @@ pub struct Camera { } impl Camera { + #[inline] pub fn get_preset(&self) -> &PresetCameraValues { self.preset.get_value() } + #[inline] pub fn set_preset(&mut self, value: PresetCameraValues) -> &mut Self { self.preset.set_value(value); self } + #[inline] pub fn get_rotation(&self) -> Option<&Rotation> { self.rotation.as_deref() } + #[inline] pub fn get_rotation_mut(&mut self) -> Option<&mut Rotation> { self.rotation.as_deref_mut() } + #[inline] pub fn set_rotation(&mut self, value: Rotation) -> &mut Self { self.rotation = Some(Box::new(value)); self diff --git a/src/structs/drawing/color2_type.rs b/src/structs/drawing/color2_type.rs index 52f42cab..1b7df3a9 100644 --- a/src/structs/drawing/color2_type.rs +++ b/src/structs/drawing/color2_type.rs @@ -14,30 +14,37 @@ pub struct Color2Type { } impl Color2Type { + #[inline] pub fn set_rgb_color_model_hex(&mut self, value: RgbColorModelHex) { self.rgb_color_model_hex = Some(Box::new(value)); } + #[inline] pub fn get_rgb_color_model_hex(&self) -> Option<&RgbColorModelHex> { self.rgb_color_model_hex.as_deref() } + #[inline] pub fn get_rgb_color_model_hex_mut(&mut self) -> Option<&mut RgbColorModelHex> { self.rgb_color_model_hex.as_deref_mut() } + #[inline] pub fn set_system_color(&mut self, value: SystemColor) { self.system_color = Some(Box::new(value)); } + #[inline] pub fn get_system_color(&self) -> Option<&SystemColor> { self.system_color.as_deref() } + #[inline] pub fn get_system_color_mut(&mut self) -> Option<&mut SystemColor> { self.system_color.as_deref_mut() } + #[inline] pub fn get_val(&self) -> String { if let Some(v) = &self.rgb_color_model_hex { return v.get_val().to_string(); @@ -106,61 +113,73 @@ impl Color2Type { ); } + #[inline] pub(crate) fn write_to_accent1(&self, writer: &mut Writer>>) { // a:accent1 self.write_to(writer, "a:accent1"); } + #[inline] pub(crate) fn write_to_accent2(&self, writer: &mut Writer>>) { // a:accent2 self.write_to(writer, "a:accent2"); } + #[inline] pub(crate) fn write_to_accent3(&self, writer: &mut Writer>>) { // a:accent3 self.write_to(writer, "a:accent3"); } + #[inline] pub(crate) fn write_to_accent4(&self, writer: &mut Writer>>) { // a:accent4 self.write_to(writer, "a:accent4"); } + #[inline] pub(crate) fn write_to_accent5(&self, writer: &mut Writer>>) { // a:accent5 self.write_to(writer, "a:accent5"); } + #[inline] pub(crate) fn write_to_accent6(&self, writer: &mut Writer>>) { // a:accent6 self.write_to(writer, "a:accent6"); } + #[inline] pub(crate) fn write_to_dk1(&self, writer: &mut Writer>>) { // a:dk1 self.write_to(writer, "a:dk1"); } + #[inline] pub(crate) fn write_to_dk2(&self, writer: &mut Writer>>) { // a:dk2 self.write_to(writer, "a:dk2"); } + #[inline] pub(crate) fn write_to_fol_hlink(&self, writer: &mut Writer>>) { // a:folHlink self.write_to(writer, "a:folHlink"); } + #[inline] pub(crate) fn write_to_hlink(&self, writer: &mut Writer>>) { // a:hlink self.write_to(writer, "a:hlink"); } + #[inline] pub(crate) fn write_to_lt1(&self, writer: &mut Writer>>) { // a:lt1 self.write_to(writer, "a:lt1"); } + #[inline] pub(crate) fn write_to_lt2(&self, writer: &mut Writer>>) { // a:lt2 self.write_to(writer, "a:lt2"); diff --git a/src/structs/drawing/color_scheme.rs b/src/structs/drawing/color_scheme.rs index ddbfe26e..5b1c95f0 100644 --- a/src/structs/drawing/color_scheme.rs +++ b/src/structs/drawing/color_scheme.rs @@ -26,159 +26,198 @@ pub struct ColorScheme { } impl ColorScheme { + #[inline] pub fn get_name(&self) -> &str { self.name.get_value_str() } + #[inline] pub fn set_name>(&mut self, value: S) -> &mut Self { self.name.set_value(value); self } + #[inline] pub fn set_accent1(&mut self, value: Color2Type) { self.accent1 = value; } + #[inline] pub fn get_accent1(&self) -> &Color2Type { &self.accent1 } + #[inline] pub fn get_accent1_mut(&mut self) -> &mut Color2Type { &mut self.accent1 } + #[inline] pub fn set_accent2(&mut self, value: Color2Type) { self.accent2 = value; } + #[inline] pub fn get_accent2(&self) -> &Color2Type { &self.accent2 } + #[inline] pub fn get_accent2_mut(&mut self) -> &mut Color2Type { &mut self.accent2 } + #[inline] pub fn set_accent3(&mut self, value: Color2Type) { self.accent3 = value; } + #[inline] pub fn get_accent3(&self) -> &Color2Type { &self.accent3 } + #[inline] pub fn get_accent3_mut(&mut self) -> &mut Color2Type { &mut self.accent3 } + #[inline] pub fn set_accent4(&mut self, value: Color2Type) { self.accent4 = value; } + #[inline] pub fn get_accent4(&self) -> &Color2Type { &self.accent4 } + #[inline] pub fn get_accent4_mut(&mut self) -> &mut Color2Type { &mut self.accent4 } + #[inline] pub fn set_accent5(&mut self, value: Color2Type) { self.accent5 = value; } + #[inline] pub fn get_accent5(&self) -> &Color2Type { &self.accent5 } + #[inline] pub fn get_accent5_mut(&mut self) -> &mut Color2Type { &mut self.accent5 } + #[inline] pub fn set_accent6(&mut self, value: Color2Type) { self.accent6 = value; } + #[inline] pub fn get_accent6(&self) -> &Color2Type { &self.accent6 } + #[inline] pub fn get_accent6_mut(&mut self) -> &mut Color2Type { &mut self.accent6 } + #[inline] pub fn set_dk1(&mut self, value: Color2Type) { self.dk1 = value; } + #[inline] pub fn get_dk1(&self) -> &Color2Type { &self.dk1 } + #[inline] pub fn get_dk1_mut(&mut self) -> &mut Color2Type { &mut self.dk1 } + #[inline] pub fn set_dk2(&mut self, value: Color2Type) { self.dk2 = value; } + #[inline] pub fn get_dk2(&self) -> &Color2Type { &self.dk2 } + #[inline] pub fn get_dk2_mut(&mut self) -> &mut Color2Type { &mut self.dk2 } + #[inline] pub fn set_fol_hlink(&mut self, value: Color2Type) { self.fol_hlink = value; } + #[inline] pub fn get_fol_hlink(&self) -> &Color2Type { &self.fol_hlink } + #[inline] pub fn get_fol_hlink_mut(&mut self) -> &mut Color2Type { &mut self.fol_hlink } + #[inline] pub fn set_hlink(&mut self, value: Color2Type) { self.hlink = value; } + #[inline] pub fn get_hlink(&self) -> &Color2Type { &self.hlink } + #[inline] pub fn get_hlink_mut(&mut self) -> &mut Color2Type { &mut self.hlink } + #[inline] pub fn set_lt1(&mut self, value: Color2Type) { self.lt1 = value; } + #[inline] pub fn get_lt1(&self) -> &Color2Type { &self.lt1 } + #[inline] pub fn get_lt1_mut(&mut self) -> &mut Color2Type { &mut self.lt1 } + #[inline] pub fn set_lt2(&mut self, value: Color2Type) { self.lt2 = value; } + #[inline] pub fn get_lt2(&self) -> &Color2Type { &self.lt2 } + #[inline] pub fn get_lt2_mut(&mut self) -> &mut Color2Type { &mut self.lt2 } + #[inline] pub fn get_color_map(&self) -> Vec { vec![ self.lt1.get_val(), diff --git a/src/structs/drawing/effect_list.rs b/src/structs/drawing/effect_list.rs index 9887b53c..d6840d5a 100644 --- a/src/structs/drawing/effect_list.rs +++ b/src/structs/drawing/effect_list.rs @@ -17,38 +17,47 @@ pub struct EffectList { } impl EffectList { + #[inline] pub fn get_glow(&self) -> Option<&Glow> { self.glow.as_deref() } + #[inline] pub fn get_glow_mut(&mut self) -> Option<&mut Glow> { self.glow.as_deref_mut() } + #[inline] pub fn set_glow(&mut self, value: Glow) { self.glow = Some(Box::new(value)); } + #[inline] pub fn get_outer_shadow(&self) -> Option<&OuterShadow> { self.outer_shadow.as_deref() } + #[inline] pub fn get_outer_shadow_mut(&mut self) -> Option<&mut OuterShadow> { self.outer_shadow.as_deref_mut() } + #[inline] pub fn set_outer_shadow(&mut self, value: OuterShadow) { self.outer_shadow = Some(Box::new(value)); } + #[inline] pub fn get_soft_edge(&self) -> Option<&SoftEdge> { self.soft_edge.as_deref() } + #[inline] pub fn get_soft_edge_mut(&mut self) -> Option<&mut SoftEdge> { self.soft_edge.as_deref_mut() } + #[inline] pub fn set_soft_edge(&mut self, value: SoftEdge) { self.soft_edge = Some(Box::new(value)); } diff --git a/src/structs/drawing/effect_style.rs b/src/structs/drawing/effect_style.rs index 86b5a97a..60cb90ff 100644 --- a/src/structs/drawing/effect_style.rs +++ b/src/structs/drawing/effect_style.rs @@ -17,40 +17,49 @@ pub struct EffectStyle { } impl EffectStyle { + #[inline] pub fn get_effect_list(&self) -> Option<&EffectList> { self.effect_list.as_deref() } + #[inline] pub fn get_effect_list_mut(&mut self) -> Option<&mut EffectList> { self.effect_list.as_deref_mut() } + #[inline] pub fn set_effect_list(&mut self, value: EffectList) -> &mut Self { self.effect_list = Some(Box::new(value)); self } + #[inline] pub fn get_scene_3d_type(&self) -> Option<&Scene3DType> { self.scene_3d_type.as_deref() } + #[inline] pub fn get_scene_3d_type_mut(&mut self) -> Option<&mut Scene3DType> { self.scene_3d_type.as_deref_mut() } + #[inline] pub fn set_scene_3d_type(&mut self, value: Scene3DType) -> &mut Self { self.scene_3d_type = Some(Box::new(value)); self } + #[inline] pub fn get_shape_3d_type(&self) -> Option<&Shape3DType> { self.shape_3d_type.as_deref() } + #[inline] pub fn get_shape_3d_type_mut(&mut self) -> Option<&mut Shape3DType> { self.shape_3d_type.as_deref_mut() } + #[inline] pub fn set_shape_3d_type(&mut self, value: Shape3DType) -> &mut Self { self.shape_3d_type = Some(Box::new(value)); self diff --git a/src/structs/drawing/effect_style_list.rs b/src/structs/drawing/effect_style_list.rs index e08f9f8c..52ed8204 100644 --- a/src/structs/drawing/effect_style_list.rs +++ b/src/structs/drawing/effect_style_list.rs @@ -13,14 +13,17 @@ pub struct EffectStyleList { } impl EffectStyleList { + #[inline] pub fn get_effect_style_collection(&self) -> &[EffectStyle] { &self.effect_style_collection } + #[inline] pub fn get_effect_style_collection_mut(&mut self) -> &mut ThinVec { &mut self.effect_style_collection } + #[inline] pub fn set_effect_style_collection( &mut self, value: impl Into>, @@ -29,6 +32,7 @@ impl EffectStyleList { self } + #[inline] pub fn add_effect_style_collection(&mut self, value: EffectStyle) -> &mut Self { self.effect_style_collection.push(value); self diff --git a/src/structs/drawing/end_connection.rs b/src/structs/drawing/end_connection.rs index 2a0a23b7..01e4330e 100644 --- a/src/structs/drawing/end_connection.rs +++ b/src/structs/drawing/end_connection.rs @@ -13,22 +13,27 @@ pub struct EndConnection { index: UInt32Value, } impl EndConnection { + #[inline] pub fn get_id(&self) -> &u32 { self.id.get_value() } + #[inline] pub fn set_id(&mut self, value: u32) { self.id.set_value(value); } + #[inline] pub fn get_index(&self) -> &u32 { self.index.get_value() } + #[inline] pub fn set_index(&mut self, value: u32) { self.index.set_value(value); } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -39,6 +44,7 @@ impl EndConnection { .set_value_string(get_attribute(e, b"idx").unwrap()); } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { write_start_tag( writer, diff --git a/src/structs/drawing/extension_list.rs b/src/structs/drawing/extension_list.rs index 4331604a..ca62416b 100644 --- a/src/structs/drawing/extension_list.rs +++ b/src/structs/drawing/extension_list.rs @@ -10,6 +10,7 @@ use writer::driver::*; #[derive(Clone, Default, Debug)] pub struct ExtensionList {} impl ExtensionList { + #[inline] pub(crate) fn set_attributes( &mut self, reader: &mut Reader, @@ -26,5 +27,6 @@ impl ExtensionList { ); } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) {} } diff --git a/src/structs/drawing/extents.rs b/src/structs/drawing/extents.rs index e1e52997..590c524b 100644 --- a/src/structs/drawing/extents.rs +++ b/src/structs/drawing/extents.rs @@ -13,24 +13,29 @@ pub struct Extents { cy: Int64Value, } impl Extents { + #[inline] pub fn get_cx(&self) -> &i64 { self.cx.get_value() } + #[inline] pub fn set_cx(&mut self, value: i64) -> &mut Extents { self.cx.set_value(value); self } + #[inline] pub fn get_cy(&self) -> &i64 { self.cy.get_value() } + #[inline] pub fn set_cy(&mut self, value: i64) -> &mut Extents { self.cy.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, diff --git a/src/structs/drawing/fill_rectangle.rs b/src/structs/drawing/fill_rectangle.rs index 92cfe455..3f738bed 100644 --- a/src/structs/drawing/fill_rectangle.rs +++ b/src/structs/drawing/fill_rectangle.rs @@ -13,38 +13,47 @@ pub struct FillRectangle { top: usize, } impl FillRectangle { + #[inline] pub fn get_bottom(&self) -> &usize { &self.bottom } + #[inline] pub fn set_bottom(&mut self, value: usize) { self.bottom = value; } + #[inline] pub fn get_left(&self) -> &usize { &self.left } + #[inline] pub fn set_left(&mut self, value: usize) { self.left = value; } + #[inline] pub fn get_right(&self) -> &usize { &self.right } + #[inline] pub fn set_right(&mut self, value: usize) { self.right = value; } + #[inline] pub fn get_top(&self) -> &usize { &self.top } + #[inline] pub fn set_top(&mut self, value: usize) { self.top = value; } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -52,6 +61,7 @@ impl FillRectangle { ) { } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { // a:fillRect write_start_tag(writer, "a:fillRect", vec![], true); diff --git a/src/structs/drawing/fill_style_list.rs b/src/structs/drawing/fill_style_list.rs index e6969412..7cadaa9e 100644 --- a/src/structs/drawing/fill_style_list.rs +++ b/src/structs/drawing/fill_style_list.rs @@ -15,32 +15,39 @@ pub struct FillStyleList { } impl FillStyleList { + #[inline] pub fn get_solid_fill(&self) -> &[SolidFill] { &self.solid_fill } + #[inline] pub fn get_solid_fill_mut(&mut self) -> &mut ThinVec { &mut self.solid_fill } + #[inline] pub fn set_solid_fill(&mut self, value: impl Into>) -> &mut Self { self.solid_fill = value.into(); self } + #[inline] pub fn add_solid_fill(&mut self, value: SolidFill) -> &mut Self { self.solid_fill.push(value); self } + #[inline] pub fn get_gradient_fill_collection(&self) -> &[GradientFill] { &self.gradient_fill_collection } + #[inline] pub fn get_gradient_fill_collectionl_mut(&mut self) -> &mut ThinVec { &mut self.gradient_fill_collection } + #[inline] pub fn set_gradient_fill_collection( &mut self, value: impl Into>, @@ -49,6 +56,7 @@ impl FillStyleList { self } + #[inline] pub fn add_gradient_fill_collection(&mut self, value: GradientFill) -> &mut Self { self.gradient_fill_collection.push(value); self diff --git a/src/structs/drawing/font_collection_type.rs b/src/structs/drawing/font_collection_type.rs index d708168a..bcd498d4 100644 --- a/src/structs/drawing/font_collection_type.rs +++ b/src/structs/drawing/font_collection_type.rs @@ -17,53 +17,65 @@ pub struct FontCollectionType { supplemental_font_list: ThinVec, } impl FontCollectionType { + #[inline] pub fn get_latin_font(&self) -> &TextFontType { &self.latin_font } + #[inline] pub fn get_latin_font_mut(&mut self) -> &mut TextFontType { &mut self.latin_font } + #[inline] pub fn set_latin_font(&mut self, value: TextFontType) -> &mut Self { self.latin_font = value; self } + #[inline] pub fn get_east_asian_font(&self) -> &TextFontType { &self.east_asian_font } + #[inline] pub fn get_east_asian_font_mut(&mut self) -> &mut TextFontType { &mut self.east_asian_font } + #[inline] pub fn set_east_asian_font(&mut self, value: TextFontType) -> &mut Self { self.east_asian_font = value; self } + #[inline] pub fn get_complex_script_font(&self) -> &TextFontType { &self.complex_script_font } + #[inline] pub fn get_complex_script_font_mut(&mut self) -> &mut TextFontType { &mut self.complex_script_font } + #[inline] pub fn set_complex_script_font(&mut self, value: TextFontType) -> &mut Self { self.complex_script_font = value; self } + #[inline] pub fn get_supplemental_font_list(&self) -> &[SupplementalFont] { &self.supplemental_font_list } + #[inline] pub fn get_supplemental_font_list_mut(&mut self) -> &mut ThinVec { &mut self.supplemental_font_list } + #[inline] pub fn set_supplemental_font_list( &mut self, value: impl Into>, @@ -72,6 +84,7 @@ impl FontCollectionType { self } + #[inline] pub fn add_supplemental_font_list(&mut self, value: SupplementalFont) -> &mut Self { self.supplemental_font_list.push(value); self @@ -150,11 +163,13 @@ impl FontCollectionType { } } + #[inline] pub(crate) fn write_to_major_font(&self, writer: &mut Writer>>) { // a:majorFont self.write_to(writer, "a:majorFont"); } + #[inline] pub(crate) fn write_to_minor_font(&self, writer: &mut Writer>>) { // a:minorFont self.write_to(writer, "a:minorFont"); diff --git a/src/structs/drawing/font_scheme.rs b/src/structs/drawing/font_scheme.rs index e25d1d4f..0cfa4ee1 100644 --- a/src/structs/drawing/font_scheme.rs +++ b/src/structs/drawing/font_scheme.rs @@ -16,36 +16,44 @@ pub struct FontScheme { } impl FontScheme { + #[inline] pub fn get_name(&self) -> &str { self.name.get_value_str() } + #[inline] pub fn set_name>(&mut self, value: S) -> &mut Self { self.name.set_value(value); self } + #[inline] pub fn get_major_font(&self) -> &FontCollectionType { &self.major_font } + #[inline] pub fn get_major_font_mut(&mut self) -> &mut FontCollectionType { &mut self.major_font } + #[inline] pub fn set_major_font(&mut self, value: FontCollectionType) -> &mut Self { self.major_font = value; self } + #[inline] pub fn get_minor_font(&self) -> &FontCollectionType { &self.minor_font } + #[inline] pub fn get_minor_font_mut(&mut self) -> &mut FontCollectionType { &mut self.minor_font } + #[inline] pub fn set_minor_font(&mut self, value: FontCollectionType) -> &mut Self { self.minor_font = value; self diff --git a/src/structs/drawing/foreground_color.rs b/src/structs/drawing/foreground_color.rs index 40510173..ff24e68b 100644 --- a/src/structs/drawing/foreground_color.rs +++ b/src/structs/drawing/foreground_color.rs @@ -13,14 +13,17 @@ pub struct ForegroundColor { } impl ForegroundColor { + #[inline] pub fn get_scheme_color(&self) -> &SchemeColor { &self.scheme_color } + #[inline] pub fn get_scheme_color_mut(&mut self) -> &mut SchemeColor { &mut self.scheme_color } + #[inline] pub fn set_scheme_color(&mut self, value: SchemeColor) -> &mut ForegroundColor { self.scheme_color = value; self diff --git a/src/structs/drawing/format_scheme.rs b/src/structs/drawing/format_scheme.rs index 0a1482ca..90245c04 100644 --- a/src/structs/drawing/format_scheme.rs +++ b/src/structs/drawing/format_scheme.rs @@ -21,59 +21,73 @@ pub struct FormatScheme { } impl FormatScheme { + #[inline] pub fn get_name(&self) -> &str { self.name.get_value_str() } + #[inline] pub fn set_name>(&mut self, value: S) -> &mut Self { self.name.set_value(value); self } + #[inline] pub fn get_fill_style_list(&self) -> &FillStyleList { &self.fill_style_list } + #[inline] pub fn get_fill_style_list_mut(&mut self) -> &mut FillStyleList { &mut self.fill_style_list } + #[inline] pub fn set_fill_style_list(&mut self, value: FillStyleList) { self.fill_style_list = value; } + #[inline] pub fn get_line_style_list(&self) -> &LineStyleList { &self.line_style_list } + #[inline] pub fn get_line_style_list_mut(&mut self) -> &mut LineStyleList { &mut self.line_style_list } + #[inline] pub fn set_line_style_list(&mut self, value: LineStyleList) { self.line_style_list = value; } + #[inline] pub fn get_effect_style_list(&self) -> &EffectStyleList { &self.effect_style_list } + #[inline] pub fn get_effect_style_list_mut(&mut self) -> &mut EffectStyleList { &mut self.effect_style_list } + #[inline] pub fn set_effect_style_list(&mut self, value: EffectStyleList) { self.effect_style_list = value; } + #[inline] pub fn get_background_fill_style_list(&self) -> &BackgroundFillStyleList { &self.background_fill_style_list } + #[inline] pub fn get_background_fill_style_list_mut(&mut self) -> &mut BackgroundFillStyleList { &mut self.background_fill_style_list } + #[inline] pub fn set_background_fill_style_list_list(&mut self, value: BackgroundFillStyleList) { self.background_fill_style_list = value; } diff --git a/src/structs/drawing/glow.rs b/src/structs/drawing/glow.rs index e042c742..b7f43bec 100644 --- a/src/structs/drawing/glow.rs +++ b/src/structs/drawing/glow.rs @@ -15,19 +15,23 @@ pub struct Glow { } impl Glow { + #[inline] pub fn get_radius(&self) -> &i64 { self.radius.get_value() } + #[inline] pub fn set_radius(&mut self, value: i64) -> &mut Glow { self.radius.set_value(value); self } + #[inline] pub fn get_scheme_color(&self) -> Option<&SchemeColor> { self.scheme_color.as_deref() } + #[inline] pub fn set_scheme_color(&mut self, value: SchemeColor) { self.scheme_color = Some(Box::new(value)); } diff --git a/src/structs/drawing/gradient_fill.rs b/src/structs/drawing/gradient_fill.rs index d000dab8..2babeed3 100644 --- a/src/structs/drawing/gradient_fill.rs +++ b/src/structs/drawing/gradient_fill.rs @@ -22,58 +22,71 @@ pub struct GradientFill { } impl GradientFill { + #[inline] pub fn get_flip(&self) -> &TileFlipValues { self.flip.get_value() } + #[inline] pub fn set_flip(&mut self, value: TileFlipValues) -> &mut GradientFill { self.flip.set_value(value); self } + #[inline] pub fn get_rotate_with_shape(&self) -> &bool { self.rotate_with_shape.get_value() } + #[inline] pub fn set_rotate_with_shape(&mut self, value: bool) -> &mut GradientFill { self.rotate_with_shape.set_value(value); self } + #[inline] pub fn get_gradient_stop_list(&self) -> &GradientStopList { &self.gradient_stop_list } + #[inline] pub fn get_gradient_stop_list_mut(&mut self) -> &mut GradientStopList { &mut self.gradient_stop_list } + #[inline] pub fn set_gradient_stop_list(&mut self, value: GradientStopList) -> &mut GradientFill { self.gradient_stop_list = value; self } + #[inline] pub fn get_linear_gradient_fill(&self) -> Option<&LinearGradientFill> { self.linear_gradient_fill.as_deref() } + #[inline] pub fn get_linear_gradient_fill_mut(&mut self) -> Option<&mut LinearGradientFill> { self.linear_gradient_fill.as_deref_mut() } + #[inline] pub fn set_linear_gradient_fill(&mut self, value: LinearGradientFill) -> &mut GradientFill { self.linear_gradient_fill = Some(Box::new(value)); self } + #[inline] pub fn get_tile_rectangle(&self) -> Option<&TileRectangle> { self.tile_rectangle.as_deref() } + #[inline] pub fn get_tile_rectangle_mut(&mut self) -> Option<&mut TileRectangle> { self.tile_rectangle.as_deref_mut() } + #[inline] pub fn set_tile_rectangle(&mut self, value: TileRectangle) -> &mut GradientFill { self.tile_rectangle = Some(Box::new(value)); self diff --git a/src/structs/drawing/gradient_stop.rs b/src/structs/drawing/gradient_stop.rs index b2519101..340061ca 100644 --- a/src/structs/drawing/gradient_stop.rs +++ b/src/structs/drawing/gradient_stop.rs @@ -16,36 +16,44 @@ pub struct GradientStop { } impl GradientStop { + #[inline] pub fn get_position(&self) -> &i32 { &self.position } + #[inline] pub fn set_position(&mut self, value: i32) -> &mut GradientStop { self.position = value; self } + #[inline] pub fn get_scheme_color(&self) -> Option<&SchemeColor> { self.scheme_color.as_deref() } + #[inline] pub fn get_scheme_color_mut(&mut self) -> Option<&mut SchemeColor> { self.scheme_color.as_deref_mut() } + #[inline] pub fn set_scheme_color(&mut self, value: SchemeColor) -> &mut GradientStop { self.scheme_color = Some(Box::new(value)); self } + #[inline] pub fn get_rgb_color_model_hex(&self) -> Option<&RgbColorModelHex> { self.rgb_color_model_hex.as_deref() } + #[inline] pub fn get_rgb_color_model_hex_mut(&mut self) -> Option<&mut RgbColorModelHex> { self.rgb_color_model_hex.as_deref_mut() } + #[inline] pub fn set_rgb_color_model_hex(&mut self, value: RgbColorModelHex) -> &mut GradientStop { self.rgb_color_model_hex = Some(Box::new(value)); self diff --git a/src/structs/drawing/gradient_stop_list.rs b/src/structs/drawing/gradient_stop_list.rs index 06a7750c..cb6e0284 100644 --- a/src/structs/drawing/gradient_stop_list.rs +++ b/src/structs/drawing/gradient_stop_list.rs @@ -14,14 +14,17 @@ pub struct GradientStopList { } impl GradientStopList { + #[inline] pub fn get_gradient_stop(&self) -> &[GradientStop] { &self.gradient_stop } + #[inline] pub fn get_gradient_stop_mut(&mut self) -> &mut ThinVec { &mut self.gradient_stop } + #[inline] pub fn set_gradient_stop( &mut self, value: impl Into>, @@ -30,6 +33,7 @@ impl GradientStopList { self } + #[inline] pub fn add_gradient_stop(&mut self, value: GradientStop) -> &mut GradientStopList { self.gradient_stop.push(value); self diff --git a/src/structs/drawing/graphic.rs b/src/structs/drawing/graphic.rs index 2d055b23..796f55f0 100644 --- a/src/structs/drawing/graphic.rs +++ b/src/structs/drawing/graphic.rs @@ -15,14 +15,17 @@ pub struct Graphic { } impl Graphic { + #[inline] pub fn get_graphic_data(&self) -> &GraphicData { &self.graphic_data } + #[inline] pub fn get_graphic_data_mut(&mut self) -> &mut GraphicData { &mut self.graphic_data } + #[inline] pub fn set_graphic_data(&mut self, value: GraphicData) -> &mut Self { self.graphic_data = value; self @@ -66,6 +69,7 @@ impl Graphic { } } impl AdjustmentCoordinateWithSheet for Graphic { + #[inline] fn adjustment_insert_coordinate_with_sheet( &mut self, sheet_name: &str, @@ -83,6 +87,7 @@ impl AdjustmentCoordinateWithSheet for Graphic { ); } + #[inline] fn adjustment_remove_coordinate_with_sheet( &mut self, sheet_name: &str, diff --git a/src/structs/drawing/graphic_data.rs b/src/structs/drawing/graphic_data.rs index 7b50b402..e1809b0b 100644 --- a/src/structs/drawing/graphic_data.rs +++ b/src/structs/drawing/graphic_data.rs @@ -17,14 +17,17 @@ pub struct GraphicData { } impl GraphicData { + #[inline] pub fn get_chart_space(&self) -> &ChartSpace { &self.chart_space } + #[inline] pub fn get_chart_space_mut(&mut self) -> &mut ChartSpace { &mut self.chart_space } + #[inline] pub fn set_chart_space(&mut self, value: ChartSpace) -> &GraphicData { self.chart_space = value; self @@ -86,6 +89,7 @@ impl GraphicData { } } impl AdjustmentCoordinateWithSheet for GraphicData { + #[inline] fn adjustment_insert_coordinate_with_sheet( &mut self, sheet_name: &str, @@ -103,6 +107,7 @@ impl AdjustmentCoordinateWithSheet for GraphicData { ); } + #[inline] fn adjustment_remove_coordinate_with_sheet( &mut self, sheet_name: &str, diff --git a/src/structs/drawing/group_shape_locks.rs b/src/structs/drawing/group_shape_locks.rs index 831b9fdc..c388a423 100644 --- a/src/structs/drawing/group_shape_locks.rs +++ b/src/structs/drawing/group_shape_locks.rs @@ -19,10 +19,12 @@ pub struct GroupShapeLocks { } impl GroupShapeLocks { + #[inline] pub fn get_no_change_aspect(&self) -> &bool { self.no_change_aspect.get_value() } + #[inline] pub fn set_no_change_aspect(&mut self, value: bool) { self.no_change_aspect.set_value(value); } diff --git a/src/structs/drawing/light_rig.rs b/src/structs/drawing/light_rig.rs index 2a06bbce..3236b424 100644 --- a/src/structs/drawing/light_rig.rs +++ b/src/structs/drawing/light_rig.rs @@ -18,32 +18,39 @@ pub struct LightRig { } impl LightRig { + #[inline] pub fn get_rig(&self) -> &LightRigValues { self.rig.get_value() } + #[inline] pub fn set_rig(&mut self, value: LightRigValues) -> &mut LightRig { self.rig.set_value(value); self } + #[inline] pub fn get_definition(&self) -> &LightRigDirectionValues { self.definition.get_value() } + #[inline] pub fn set_definition(&mut self, value: LightRigDirectionValues) -> &mut LightRig { self.definition.set_value(value); self } + #[inline] pub fn get_rotation(&self) -> Option<&Rotation> { self.rotation.as_deref() } + #[inline] pub fn get_rotation_mut(&mut self) -> Option<&mut Rotation> { self.rotation.as_deref_mut() } + #[inline] pub fn set_rotation(&mut self, value: Rotation) -> &mut Self { self.rotation = Some(Box::new(value)); self diff --git a/src/structs/drawing/light_rig_direction_values.rs b/src/structs/drawing/light_rig_direction_values.rs index 628868fd..6c1b7e87 100644 --- a/src/structs/drawing/light_rig_direction_values.rs +++ b/src/structs/drawing/light_rig_direction_values.rs @@ -12,11 +12,13 @@ pub enum LightRigDirectionValues { TopRight, } impl Default for LightRigDirectionValues { + #[inline] fn default() -> Self { Self::TopLeft } } impl EnumTrait for LightRigDirectionValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::Bottom => "b", @@ -32,6 +34,8 @@ impl EnumTrait for LightRigDirectionValues { } impl FromStr for LightRigDirectionValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "b" => Ok(Self::Bottom), diff --git a/src/structs/drawing/light_rig_values.rs b/src/structs/drawing/light_rig_values.rs index 87072274..cd175c34 100644 --- a/src/structs/drawing/light_rig_values.rs +++ b/src/structs/drawing/light_rig_values.rs @@ -31,11 +31,13 @@ pub enum LightRigValues { TwoPoints, } impl Default for LightRigValues { + #[inline] fn default() -> Self { Self::LegacyFlat1 } } impl EnumTrait for LightRigValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::Balanced => "balanced", @@ -70,6 +72,8 @@ impl EnumTrait for LightRigValues { } impl FromStr for LightRigValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "balanced" => Ok(Self::Balanced), diff --git a/src/structs/drawing/line_spacing.rs b/src/structs/drawing/line_spacing.rs index 401fee09..ce4aee77 100644 --- a/src/structs/drawing/line_spacing.rs +++ b/src/structs/drawing/line_spacing.rs @@ -13,19 +13,23 @@ pub struct LineSpacing { } impl LineSpacing { + #[inline] pub fn get_spacing_percent(&self) -> Option<&SpacingPercent> { self.spacing_percent.as_ref() } + #[inline] pub fn get_spacing_percent_mut(&mut self) -> Option<&mut SpacingPercent> { self.spacing_percent.as_mut() } + #[inline] pub fn set_spacing_percent(&mut self, value: SpacingPercent) -> &mut Self { self.spacing_percent = Some(value); self } + #[inline] pub fn remove_spacing_percent(&mut self) { self.spacing_percent = None; } diff --git a/src/structs/drawing/line_style_list.rs b/src/structs/drawing/line_style_list.rs index 425b658b..dd9a5eaf 100644 --- a/src/structs/drawing/line_style_list.rs +++ b/src/structs/drawing/line_style_list.rs @@ -13,19 +13,23 @@ pub struct LineStyleList { } impl LineStyleList { + #[inline] pub fn get_outline_collection(&self) -> &[Outline] { &self.outline_collection } + #[inline] pub fn get_outline_collection_mut(&mut self) -> &mut ThinVec { &mut self.outline_collection } + #[inline] pub fn set_outline_collection(&mut self, value: impl Into>) -> &mut Self { self.outline_collection = value.into(); self } + #[inline] pub fn add_outline_collection(&mut self, value: Outline) -> &mut Self { self.outline_collection.push(value); self diff --git a/src/structs/drawing/linear_gradient_fill.rs b/src/structs/drawing/linear_gradient_fill.rs index e3302ddc..253df2ed 100644 --- a/src/structs/drawing/linear_gradient_fill.rs +++ b/src/structs/drawing/linear_gradient_fill.rs @@ -15,24 +15,29 @@ pub struct LinearGradientFill { } impl LinearGradientFill { + #[inline] pub fn get_angle(&self) -> &i32 { self.angle.get_value() } + #[inline] pub fn set_angle(&mut self, value: i32) -> &mut LinearGradientFill { self.angle.set_value(value); self } + #[inline] pub fn get_scaled(&self) -> &bool { self.scaled.get_value() } + #[inline] pub fn set_scaled(&mut self, value: bool) -> &mut LinearGradientFill { self.scaled.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, diff --git a/src/structs/drawing/list_style.rs b/src/structs/drawing/list_style.rs index cc3ca69a..aa9f0ea8 100644 --- a/src/structs/drawing/list_style.rs +++ b/src/structs/drawing/list_style.rs @@ -16,25 +16,30 @@ pub struct ListStyle { } impl ListStyle { + #[inline] pub fn get_effect_list(&self) -> Option<&EffectList> { self.effect_list.as_deref() } + #[inline] pub fn get_effect_list_mut(&mut self) -> Option<&mut EffectList> { self.effect_list.as_deref_mut() } + #[inline] pub fn set_effect_list(&mut self, value: EffectList) -> &mut Self { self.effect_list = Some(Box::new(value)); self } + #[inline] pub fn get_default_paragraph_properties(&self) -> Option<&TextParagraphPropertiesType> { self.text_paragraph_properties_type .get("def") .map(Box::as_ref) } + #[inline] pub fn get_default_paragraph_properties_mut( &mut self, ) -> Option<&mut TextParagraphPropertiesType> { @@ -43,6 +48,7 @@ impl ListStyle { .map(Box::as_mut) } + #[inline] pub fn set_default_paragraph_properties( &mut self, value: TextParagraphPropertiesType, @@ -52,12 +58,14 @@ impl ListStyle { self } + #[inline] pub fn get_level1_paragraph_properties(&self) -> Option<&TextParagraphPropertiesType> { self.text_paragraph_properties_type .get("lv1") .map(Box::as_ref) } + #[inline] pub fn get_level1_paragraph_properties_mut( &mut self, ) -> Option<&mut TextParagraphPropertiesType> { @@ -66,6 +74,7 @@ impl ListStyle { .map(Box::as_mut) } + #[inline] pub fn set_level1_paragraph_properties( &mut self, value: TextParagraphPropertiesType, @@ -75,12 +84,14 @@ impl ListStyle { self } + #[inline] pub fn get_level2_paragraph_properties(&self) -> Option<&TextParagraphPropertiesType> { self.text_paragraph_properties_type .get("lv2") .map(Box::as_ref) } + #[inline] pub fn get_level2_paragraph_properties_mut( &mut self, ) -> Option<&mut TextParagraphPropertiesType> { @@ -89,6 +100,7 @@ impl ListStyle { .map(Box::as_mut) } + #[inline] pub fn set_level2_paragraph_properties( &mut self, value: TextParagraphPropertiesType, @@ -98,12 +110,14 @@ impl ListStyle { self } + #[inline] pub fn get_level3_paragraph_properties(&self) -> Option<&TextParagraphPropertiesType> { self.text_paragraph_properties_type .get("lv3") .map(Box::as_ref) } + #[inline] pub fn get_level3_paragraph_properties_mut( &mut self, ) -> Option<&mut TextParagraphPropertiesType> { @@ -112,6 +126,7 @@ impl ListStyle { .map(Box::as_mut) } + #[inline] pub fn set_level3_paragraph_properties( &mut self, value: TextParagraphPropertiesType, @@ -121,12 +136,14 @@ impl ListStyle { self } + #[inline] pub fn get_level4_paragraph_properties(&self) -> Option<&TextParagraphPropertiesType> { self.text_paragraph_properties_type .get("lv4") .map(Box::as_ref) } + #[inline] pub fn get_level4_paragraph_properties_mut( &mut self, ) -> Option<&mut TextParagraphPropertiesType> { @@ -135,6 +152,7 @@ impl ListStyle { .map(Box::as_mut) } + #[inline] pub fn set_level4_paragraph_properties( &mut self, value: TextParagraphPropertiesType, @@ -144,12 +162,14 @@ impl ListStyle { self } + #[inline] pub fn get_level5_paragraph_properties(&self) -> Option<&TextParagraphPropertiesType> { self.text_paragraph_properties_type .get("lv5") .map(Box::as_ref) } + #[inline] pub fn get_level5_paragraph_properties_mut( &mut self, ) -> Option<&mut TextParagraphPropertiesType> { @@ -158,6 +178,7 @@ impl ListStyle { .map(Box::as_mut) } + #[inline] pub fn set_level5_paragraph_properties( &mut self, value: TextParagraphPropertiesType, @@ -167,12 +188,14 @@ impl ListStyle { self } + #[inline] pub fn get_level6_paragraph_properties(&self) -> Option<&TextParagraphPropertiesType> { self.text_paragraph_properties_type .get("lv6") .map(Box::as_ref) } + #[inline] pub fn get_level6_paragraph_properties_mut( &mut self, ) -> Option<&mut TextParagraphPropertiesType> { @@ -181,6 +204,7 @@ impl ListStyle { .map(Box::as_mut) } + #[inline] pub fn set_level6_paragraph_properties( &mut self, value: TextParagraphPropertiesType, @@ -190,12 +214,14 @@ impl ListStyle { self } + #[inline] pub fn get_level7_paragraph_properties(&self) -> Option<&TextParagraphPropertiesType> { self.text_paragraph_properties_type .get("lv7") .map(Box::as_ref) } + #[inline] pub fn get_level7_paragraph_properties_mut( &mut self, ) -> Option<&mut TextParagraphPropertiesType> { @@ -204,6 +230,7 @@ impl ListStyle { .map(Box::as_mut) } + #[inline] pub fn set_level7_paragraph_properties( &mut self, value: TextParagraphPropertiesType, @@ -213,12 +240,14 @@ impl ListStyle { self } + #[inline] pub fn get_level8_paragraph_properties(&self) -> Option<&TextParagraphPropertiesType> { self.text_paragraph_properties_type .get("lv8") .map(Box::as_ref) } + #[inline] pub fn get_level8_paragraph_properties_mut( &mut self, ) -> Option<&mut TextParagraphPropertiesType> { @@ -227,6 +256,7 @@ impl ListStyle { .map(Box::as_mut) } + #[inline] pub fn set_level8_paragraph_properties( &mut self, value: TextParagraphPropertiesType, @@ -236,12 +266,14 @@ impl ListStyle { self } + #[inline] pub fn get_level9_paragraph_properties(&self) -> Option<&TextParagraphPropertiesType> { self.text_paragraph_properties_type .get("lv9") .map(Box::as_ref) } + #[inline] pub fn get_level9_paragraph_properties_mut( &mut self, ) -> Option<&mut TextParagraphPropertiesType> { @@ -250,6 +282,7 @@ impl ListStyle { .map(Box::as_mut) } + #[inline] pub fn set_level9_paragraph_properties( &mut self, value: TextParagraphPropertiesType, @@ -334,6 +367,7 @@ impl ListStyle { ); } + #[inline] fn is_empty(&self) -> bool { self.effect_list.is_none() && self.text_paragraph_properties_type.is_empty() } diff --git a/src/structs/drawing/miter.rs b/src/structs/drawing/miter.rs index 1d060514..36419ff8 100644 --- a/src/structs/drawing/miter.rs +++ b/src/structs/drawing/miter.rs @@ -13,15 +13,18 @@ pub struct Miter { } impl Miter { + #[inline] pub fn get_limit(&self) -> &i32 { self.limit.get_value() } + #[inline] pub fn set_limit(&mut self, value: i32) -> &mut Self { self.limit.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, diff --git a/src/structs/drawing/no_fill.rs b/src/structs/drawing/no_fill.rs index 55727069..b31910e5 100644 --- a/src/structs/drawing/no_fill.rs +++ b/src/structs/drawing/no_fill.rs @@ -8,6 +8,7 @@ use writer::driver::*; #[derive(Clone, Default, Debug)] pub struct NoFill {} impl NoFill { + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -15,6 +16,7 @@ impl NoFill { ) { } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { // a:noFill write_start_tag(writer, "a:noFill", vec![], true); diff --git a/src/structs/drawing/offset.rs b/src/structs/drawing/offset.rs index ce1e0051..58f337c6 100644 --- a/src/structs/drawing/offset.rs +++ b/src/structs/drawing/offset.rs @@ -13,22 +13,27 @@ pub struct Offset { y: Int64Value, } impl Offset { + #[inline] pub fn get_x(&self) -> &i64 { self.x.get_value() } + #[inline] pub fn set_x(&mut self, value: i64) { self.x.set_value(value); } + #[inline] pub fn get_y(&self) -> &i64 { self.y.get_value() } + #[inline] pub fn set_y(&mut self, value: i64) { self.y.set_value(value); } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, diff --git a/src/structs/drawing/outer_shadow.rs b/src/structs/drawing/outer_shadow.rs index b1b334a6..d41a8de7 100644 --- a/src/structs/drawing/outer_shadow.rs +++ b/src/structs/drawing/outer_shadow.rs @@ -25,55 +25,67 @@ pub struct OuterShadow { } impl OuterShadow { + #[inline] pub fn get_blur_radius(&self) -> Option<&str> { self.blur_radius.get_value() } + #[inline] pub fn set_blur_radius>(&mut self, value: S) -> &mut Self { self.blur_radius.set_value(value); self } + #[inline] pub fn get_horizontal_ratio(&self) -> Option<&str> { self.horizontal_ratio.get_value() } + #[inline] pub fn set_horizontal_ratio>(&mut self, value: S) -> &mut Self { self.horizontal_ratio.set_value(value); self } + #[inline] pub fn get_vertical_ratio(&self) -> Option<&str> { self.vertical_ratio.get_value() } + #[inline] pub fn set_vertical_ratio>(&mut self, value: S) -> &mut Self { self.vertical_ratio.set_value(value); self } + #[inline] pub fn get_alignment(&self) -> Option<&str> { self.alignment.get_value() } + #[inline] pub fn set_alignment>(&mut self, value: S) -> &mut Self { self.alignment.set_value(value); self } + #[inline] pub fn get_direction(&self) -> Option<&str> { self.direction.get_value() } + #[inline] pub fn set_direction>(&mut self, value: S) -> &mut Self { self.direction.set_value(value); self } + #[inline] pub fn get_distance(&self) -> Option<&str> { self.distance.get_value() } + #[inline] pub fn set_distance>(&mut self, value: S) -> &mut Self { self.distance.set_value(value); self @@ -83,45 +95,55 @@ impl OuterShadow { self.rotate_with_shape.get_value() } + #[inline] pub fn set_rotate_with_shape>(&mut self, value: S) -> &mut Self { self.rotate_with_shape.set_value(value); self } + #[inline] pub fn get_preset_color(&self) -> Option<&PresetColor> { self.preset_color.as_deref() } + #[inline] pub fn get_preset_color_mut(&mut self) -> Option<&mut PresetColor> { self.preset_color.as_deref_mut() } + #[inline] pub fn set_preset_color(&mut self, value: PresetColor) -> &mut Self { self.preset_color = Some(Box::new(value)); self } + #[inline] pub fn get_scheme_color(&self) -> Option<&SchemeColor> { self.scheme_color.as_deref() } + #[inline] pub fn get_scheme_color_mut(&mut self) -> Option<&mut SchemeColor> { self.scheme_color.as_deref_mut() } + #[inline] pub fn set_scheme_color(&mut self, value: SchemeColor) -> &mut Self { self.scheme_color = Some(Box::new(value)); self } + #[inline] pub fn get_rgb_color_model_hex(&self) -> Option<&RgbColorModelHex> { self.rgb_color_model_hex.as_deref() } + #[inline] pub fn get_rgb_color_model_hex_mut(&mut self) -> Option<&mut RgbColorModelHex> { self.rgb_color_model_hex.as_deref_mut() } + #[inline] pub fn set_rgb_color_model_hex(&mut self, value: RgbColorModelHex) -> &mut Self { self.rgb_color_model_hex = Some(Box::new(value)); self diff --git a/src/structs/drawing/outline.rs b/src/structs/drawing/outline.rs index 093e9317..6b28ed2c 100644 --- a/src/structs/drawing/outline.rs +++ b/src/structs/drawing/outline.rs @@ -35,141 +35,173 @@ pub struct Outline { } impl Outline { + #[inline] pub fn get_width(&self) -> &u32 { self.width.get_value() } + #[inline] pub fn set_width(&mut self, value: u32) -> &mut Self { self.width.set_value(value); self } + #[inline] pub fn get_cap_type(&self) -> Option<&str> { self.cap_type.get_value() } + #[inline] pub fn set_cap_type>(&mut self, value: S) -> &mut Self { self.cap_type.set_value(value); self } + #[inline] pub fn get_compound_line_type(&self) -> Option<&str> { self.compound_line_type.get_value() } + #[inline] pub fn set_compound_line_type>(&mut self, value: S) -> &mut Self { self.compound_line_type.set_value(value); self } + #[inline] pub fn get_solid_fill(&self) -> Option<&SolidFill> { self.solid_fill.as_deref() } + #[inline] pub fn get_solid_fill_mut(&mut self) -> Option<&mut SolidFill> { self.solid_fill.as_deref_mut() } + #[inline] pub fn set_solid_fill(&mut self, value: SolidFill) -> &mut Self { self.solid_fill = Some(Box::new(value)); self } + #[inline] pub fn get_gradient_fill(&self) -> Option<&GradientFill> { self.gradient_fill.as_deref() } + #[inline] pub fn get_gradient_fill_mut(&mut self) -> Option<&mut GradientFill> { self.gradient_fill.as_deref_mut() } + #[inline] pub fn set_gradient_fill(&mut self, value: GradientFill) -> &mut Self { self.gradient_fill = Some(Box::new(value)); self } + #[inline] pub fn get_tail_end(&self) -> Option<&TailEnd> { self.tail_end.as_deref() } + #[inline] pub fn get_tail_end_mut(&mut self) -> Option<&mut TailEnd> { self.tail_end.as_deref_mut() } + #[inline] pub fn set_tail_end(&mut self, value: TailEnd) -> &mut Self { self.tail_end = Some(Box::new(value)); self } + #[inline] pub fn get_no_fill(&self) -> Option<&NoFill> { self.no_fill.as_ref() } + #[inline] pub fn get_no_fill_mut(&mut self) -> Option<&mut NoFill> { self.no_fill.as_mut() } + #[inline] pub fn set_no_fill(&mut self, value: NoFill) -> &mut Self { self.no_fill = Some(value); self } + #[inline] pub fn get_bevel(&self) -> Option<&Bevel> { self.bevel.as_deref() } + #[inline] pub fn get_bevel_mut(&mut self) -> Option<&mut Bevel> { self.bevel.as_deref_mut() } + #[inline] pub fn set_bevel(&mut self, value: Bevel) -> &mut Self { self.bevel = Some(Box::new(value)); self } + #[inline] pub fn get_preset_dash(&self) -> Option<&PresetDash> { self.preset_dash.as_ref() } + #[inline] pub fn get_preset_dash_mut(&mut self) -> Option<&mut PresetDash> { self.preset_dash.as_mut() } + #[inline] pub fn set_preset_dash(&mut self, value: PresetDash) -> &mut Self { self.preset_dash = Some(value); self } + #[inline] pub fn get_miter(&self) -> Option<&Miter> { self.miter.as_ref() } + #[inline] pub fn get_miter_mut(&mut self) -> Option<&mut Miter> { self.miter.as_mut() } + #[inline] pub fn set_miter(&mut self, value: Miter) -> &mut Self { self.miter = Some(value); self } + #[inline] pub fn get_round(&self) -> Option<&Round> { self.round.as_ref() } + #[inline] pub fn get_round_mut(&mut self) -> Option<&mut Round> { self.round.as_mut() } + #[inline] pub fn set_round(&mut self, value: Round) -> &mut Self { self.round = Some(value); self } + #[inline] pub fn get_alignment(&self) -> &PenAlignmentValues { self.alignment.get_value() } + #[inline] pub fn set_alignment(&mut self, value: PenAlignmentValues) { self.alignment.set_value(value); } diff --git a/src/structs/drawing/paragraph.rs b/src/structs/drawing/paragraph.rs index 39e68989..3fb6e605 100644 --- a/src/structs/drawing/paragraph.rs +++ b/src/structs/drawing/paragraph.rs @@ -18,40 +18,49 @@ pub struct Paragraph { } impl Paragraph { + #[inline] pub fn get_paragraph_properties(&self) -> &ParagraphProperties { &self.paragraph_properties } + #[inline] pub fn get_paragraph_properties_mut(&mut self) -> &mut ParagraphProperties { &mut self.paragraph_properties } + #[inline] pub fn set_paragraph_properties(&mut self, value: ParagraphProperties) -> &mut Paragraph { self.paragraph_properties = value; self } + #[inline] pub fn get_run(&self) -> &[Run] { &self.run } + #[inline] pub fn add_run(&mut self, value: Run) { self.run.push(value); } + #[inline] pub fn get_end_para_run_properties(&self) -> Option<&RunProperties> { self.end_para_run_properties.as_deref() } + #[inline] pub fn get_end_para_run_properties_mut(&mut self) -> Option<&mut RunProperties> { self.end_para_run_properties.as_deref_mut() } + #[inline] pub fn set_end_para_run_properties(&mut self, value: RunProperties) -> &mut Paragraph { self.end_para_run_properties = Some(Box::new(value)); self } + #[inline] pub fn remove_end_para_run_properties(&mut self) { self.end_para_run_properties = None; } diff --git a/src/structs/drawing/paragraph_properties.rs b/src/structs/drawing/paragraph_properties.rs index 16fdb4f6..56e70ebc 100644 --- a/src/structs/drawing/paragraph_properties.rs +++ b/src/structs/drawing/paragraph_properties.rs @@ -20,45 +20,55 @@ pub struct ParagraphProperties { } impl ParagraphProperties { + #[inline] pub fn get_right_to_left(&self) -> Option<&str> { self.right_to_left.get_value() } + #[inline] pub fn set_right_to_left>(&mut self, value: S) -> &mut ParagraphProperties { self.right_to_left.set_value(value); self } + #[inline] pub fn get_alignment(&self) -> &TextAlignmentTypeValues { self.alignment.get_value() } + #[inline] pub fn set_alignment(&mut self, value: TextAlignmentTypeValues) -> &mut ParagraphProperties { self.alignment.set_value(value); self } + #[inline] pub fn get_default_run_properties(&self) -> Option<&RunProperties> { self.default_run_properties.as_deref() } + #[inline] pub fn get_default_run_properties_mut(&mut self) -> Option<&mut RunProperties> { self.default_run_properties.as_deref_mut() } + #[inline] pub fn set_default_run_properties(&mut self, value: RunProperties) -> &mut ParagraphProperties { self.default_run_properties = Some(Box::new(value)); self } + #[inline] pub fn get_line_spacing(&self) -> Option<&LineSpacing> { self.line_spacing.as_ref() } + #[inline] pub fn get_line_spacing_mut(&mut self) -> Option<&mut LineSpacing> { self.line_spacing.as_mut() } + #[inline] pub fn set_line_spacing(&mut self, value: LineSpacing) -> &mut Self { self.line_spacing = Some(value); self diff --git a/src/structs/drawing/pattern_fill.rs b/src/structs/drawing/pattern_fill.rs index 45b85e48..21dd1af5 100644 --- a/src/structs/drawing/pattern_fill.rs +++ b/src/structs/drawing/pattern_fill.rs @@ -16,6 +16,7 @@ pub struct PatternFill { } impl Default for PatternFill { + #[inline] fn default() -> Self { Self { preset: "pct5".into(), @@ -26,36 +27,44 @@ impl Default for PatternFill { } impl PatternFill { + #[inline] pub fn get_preset(&self) -> &str { &self.preset } + #[inline] pub fn set_preset(&mut self, value: String) -> &mut PatternFill { self.preset = value.into_boxed_str(); self } + #[inline] pub fn get_foreground_color(&self) -> &ForegroundColor { &self.foreground_color } + #[inline] pub fn get_foreground_color_mut(&mut self) -> &mut ForegroundColor { &mut self.foreground_color } + #[inline] pub fn set_foreground_color(&mut self, value: ForegroundColor) -> &mut PatternFill { self.foreground_color = value; self } + #[inline] pub fn get_background_color(&self) -> &BackgroundColor { &self.background_color } + #[inline] pub fn get_background_color_mut(&mut self) -> &mut BackgroundColor { &mut self.background_color } + #[inline] pub fn set_background_color(&mut self, value: BackgroundColor) -> &mut PatternFill { self.background_color = value; self diff --git a/src/structs/drawing/pen_alignment_values.rs b/src/structs/drawing/pen_alignment_values.rs index d128bb6a..c5f1fba3 100644 --- a/src/structs/drawing/pen_alignment_values.rs +++ b/src/structs/drawing/pen_alignment_values.rs @@ -6,11 +6,13 @@ pub enum PenAlignmentValues { Insert, } impl Default for PenAlignmentValues { + #[inline] fn default() -> Self { Self::Center } } impl EnumTrait for PenAlignmentValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::Center => "ctr", @@ -20,6 +22,8 @@ impl EnumTrait for PenAlignmentValues { } impl FromStr for PenAlignmentValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "ctr" => Ok(Self::Center), diff --git a/src/structs/drawing/percentage_type.rs b/src/structs/drawing/percentage_type.rs index 40ff4204..67c3f691 100644 --- a/src/structs/drawing/percentage_type.rs +++ b/src/structs/drawing/percentage_type.rs @@ -12,15 +12,18 @@ pub struct PercentageType { } impl PercentageType { + #[inline] pub fn get_val(&self) -> &i32 { self.val.get_value() } + #[inline] pub fn set_val(&mut self, value: i32) -> &mut Self { self.val.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -29,22 +32,27 @@ impl PercentageType { set_string_from_xml!(self, e, val, "val"); } + #[inline] pub(crate) fn write_to_lum(&self, writer: &mut Writer>>) { self.write_to(writer, "a:lum") } + #[inline] pub(crate) fn write_to_lum_mod(&self, writer: &mut Writer>>) { self.write_to(writer, "a:lumMod") } + #[inline] pub(crate) fn write_to_lum_off(&self, writer: &mut Writer>>) { self.write_to(writer, "a:lumOff") } + #[inline] pub(crate) fn write_to_sat(&self, writer: &mut Writer>>) { self.write_to(writer, "a:sat") } + #[inline] pub(crate) fn write_to_sat_mod(&self, writer: &mut Writer>>) { self.write_to(writer, "a:satMod") } diff --git a/src/structs/drawing/picture_locks.rs b/src/structs/drawing/picture_locks.rs index 38daca22..c7dae965 100644 --- a/src/structs/drawing/picture_locks.rs +++ b/src/structs/drawing/picture_locks.rs @@ -12,14 +12,17 @@ pub struct PictureLocks { } impl PictureLocks { + #[inline] pub fn get_no_change_aspect(&self) -> &bool { &self.no_change_aspect } + #[inline] pub fn set_no_change_aspect(&mut self, value: bool) { self.no_change_aspect = value; } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -32,6 +35,7 @@ impl PictureLocks { } } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { // a:picLocks let no_change_aspect = if self.no_change_aspect { "1" } else { "2" }; diff --git a/src/structs/drawing/point_2d_type.rs b/src/structs/drawing/point_2d_type.rs index 5fb76005..fd7c88f4 100644 --- a/src/structs/drawing/point_2d_type.rs +++ b/src/structs/drawing/point_2d_type.rs @@ -15,22 +15,27 @@ pub struct Point2DType { } impl Point2DType { + #[inline] pub fn get_x(&self) -> &i64 { &self.x.get_value() } + #[inline] pub fn set_x(&mut self, value: i64) { self.x.set_value(value); } + #[inline] pub fn get_y(&self) -> &i64 { &self.y.get_value() } + #[inline] pub fn set_y(&mut self, value: i64) { self.y.set_value(value); } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -40,10 +45,12 @@ impl Point2DType { set_string_from_xml!(self, e, y, "y"); } + #[inline] pub(crate) fn write_to_off(&self, writer: &mut Writer>>) { self.write_to(writer, "a:off"); } + #[inline] pub(crate) fn write_to_ch_off(&self, writer: &mut Writer>>) { self.write_to(writer, "a:chOff"); } diff --git a/src/structs/drawing/positive_fixed_percentage_type.rs b/src/structs/drawing/positive_fixed_percentage_type.rs index efe24d97..111a7109 100644 --- a/src/structs/drawing/positive_fixed_percentage_type.rs +++ b/src/structs/drawing/positive_fixed_percentage_type.rs @@ -12,15 +12,18 @@ pub struct PositiveFixedPercentageType { } impl PositiveFixedPercentageType { + #[inline] pub fn get_val(&self) -> &i32 { self.val.get_value() } + #[inline] pub fn set_val(&mut self, value: i32) -> &mut Self { self.val.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -29,14 +32,17 @@ impl PositiveFixedPercentageType { set_string_from_xml!(self, e, val, "val"); } + #[inline] pub(crate) fn write_to_shade(&self, writer: &mut Writer>>) { self.write_to(writer, "a:shade") } + #[inline] pub(crate) fn write_to_alpha(&self, writer: &mut Writer>>) { self.write_to(writer, "a:alpha") } + #[inline] pub(crate) fn write_to_tint(&self, writer: &mut Writer>>) { self.write_to(writer, "a:tint") } diff --git a/src/structs/drawing/positive_size_2d_type.rs b/src/structs/drawing/positive_size_2d_type.rs index 9650e49a..97e69305 100644 --- a/src/structs/drawing/positive_size_2d_type.rs +++ b/src/structs/drawing/positive_size_2d_type.rs @@ -15,22 +15,27 @@ pub struct PositiveSize2DType { } impl PositiveSize2DType { + #[inline] pub fn get_cx(&self) -> &i64 { &self.cx.get_value() } + #[inline] pub fn set_cx(&mut self, value: i64) { self.cx.set_value(value); } + #[inline] pub fn get_cy(&self) -> &i64 { &self.cy.get_value() } + #[inline] pub fn set_cy(&mut self, value: i64) { self.cy.set_value(value); } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -40,10 +45,12 @@ impl PositiveSize2DType { set_string_from_xml!(self, e, cy, "cy"); } + #[inline] pub(crate) fn write_to_ext(&self, writer: &mut Writer>>) { self.write_to(writer, "a:ext"); } + #[inline] pub(crate) fn write_to_ch_ext(&self, writer: &mut Writer>>) { self.write_to(writer, "a:chExt"); } diff --git a/src/structs/drawing/preset_camera_values.rs b/src/structs/drawing/preset_camera_values.rs index db188415..f1cdee46 100644 --- a/src/structs/drawing/preset_camera_values.rs +++ b/src/structs/drawing/preset_camera_values.rs @@ -66,11 +66,13 @@ pub enum PresetCameraValues { PerspectiveRight, } impl Default for PresetCameraValues { + #[inline] fn default() -> Self { Self::LegacyObliqueTopLeft } } impl EnumTrait for PresetCameraValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::IsometricBottomDown => "isometricBottomDown", @@ -140,6 +142,8 @@ impl EnumTrait for PresetCameraValues { } impl FromStr for PresetCameraValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "isometricBottomDown" => Ok(Self::IsometricBottomDown), diff --git a/src/structs/drawing/preset_color.rs b/src/structs/drawing/preset_color.rs index 4f9f2491..fc639374 100644 --- a/src/structs/drawing/preset_color.rs +++ b/src/structs/drawing/preset_color.rs @@ -14,22 +14,27 @@ pub struct PresetColor { } impl PresetColor { + #[inline] pub fn get_val(&self) -> &str { &self.val } + #[inline] pub fn set_val>(&mut self, value: S) { self.val = value.into().into_boxed_str(); } + #[inline] pub fn get_alpha(&self) -> Option<&Alpha> { self.alpha.as_ref() } + #[inline] pub fn get_alpha_mut(&mut self) -> Option<&mut Alpha> { self.alpha.as_mut() } + #[inline] pub fn set_alpha(&mut self, value: Alpha) { self.alpha = Some(value); } diff --git a/src/structs/drawing/preset_dash.rs b/src/structs/drawing/preset_dash.rs index 5dcb306c..9e5ccefe 100644 --- a/src/structs/drawing/preset_dash.rs +++ b/src/structs/drawing/preset_dash.rs @@ -13,15 +13,18 @@ pub struct PresetDash { val: EnumValue, } impl PresetDash { + #[inline] pub fn get_val(&self) -> &PresetLineDashValues { self.val.get_value() } + #[inline] pub fn set_val(&mut self, value: PresetLineDashValues) -> &mut PresetDash { self.val.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, diff --git a/src/structs/drawing/preset_geometry.rs b/src/structs/drawing/preset_geometry.rs index f010c886..2b30484d 100644 --- a/src/structs/drawing/preset_geometry.rs +++ b/src/structs/drawing/preset_geometry.rs @@ -203,22 +203,27 @@ impl PresetGeometry { pub const GEOMETRY_WEDGERECTCALLOUT: &'static str = "wedgeRectCallout"; pub const GEOMETRY_WEDGEROUNDRECTCALLOUT: &'static str = "wedgeRoundRectCallout"; + #[inline] pub fn get_geometry(&self) -> &str { &self.geometry } + #[inline] pub fn set_geometry>(&mut self, value: S) { self.geometry = value.into().into_boxed_str(); } + #[inline] pub fn get_adjust_value_list(&self) -> &AdjustValueList { &self.adjust_value_list } + #[inline] pub fn get_adjust_value_list_mut(&mut self) -> &mut AdjustValueList { &mut self.adjust_value_list } + #[inline] pub fn set_adjust_value_list(&mut self, value: AdjustValueList) { self.adjust_value_list = value; } diff --git a/src/structs/drawing/preset_line_dash_values.rs b/src/structs/drawing/preset_line_dash_values.rs index 5b488fb0..4a697f49 100644 --- a/src/structs/drawing/preset_line_dash_values.rs +++ b/src/structs/drawing/preset_line_dash_values.rs @@ -15,11 +15,13 @@ pub enum PresetLineDashValues { SystemDot, } impl Default for PresetLineDashValues { + #[inline] fn default() -> Self { Self::Solid } } impl EnumTrait for PresetLineDashValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::Dash => "dash", @@ -38,6 +40,8 @@ impl EnumTrait for PresetLineDashValues { } impl FromStr for PresetLineDashValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "dash" => Ok(Self::Dash), diff --git a/src/structs/drawing/preset_material_type_values.rs b/src/structs/drawing/preset_material_type_values.rs index e21d248f..76ae5837 100644 --- a/src/structs/drawing/preset_material_type_values.rs +++ b/src/structs/drawing/preset_material_type_values.rs @@ -19,11 +19,13 @@ pub enum PresetMaterialTypeValues { WarmMatte, } impl Default for PresetMaterialTypeValues { + #[inline] fn default() -> Self { Self::LegacyMatte } } impl EnumTrait for PresetMaterialTypeValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::Clear => "clear", @@ -46,6 +48,8 @@ impl EnumTrait for PresetMaterialTypeValues { } impl FromStr for PresetMaterialTypeValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "clear" => Ok(Self::Clear), diff --git a/src/structs/drawing/rgb_color_model_hex.rs b/src/structs/drawing/rgb_color_model_hex.rs index 1e4f3848..82c8e7bb 100644 --- a/src/structs/drawing/rgb_color_model_hex.rs +++ b/src/structs/drawing/rgb_color_model_hex.rs @@ -24,111 +24,138 @@ pub struct RgbColorModelHex { } impl RgbColorModelHex { + #[inline] pub fn get_val(&self) -> &str { self.val.get_value_str() } + #[inline] pub fn set_val>(&mut self, value: S) -> &mut Self { self.val.set_value(value); self } + #[inline] pub fn get_luminance(&self) -> Option<&PercentageType> { self.luminance.as_ref() } + #[inline] pub fn get_luminance_mut(&mut self) -> Option<&mut PercentageType> { self.luminance.as_mut() } + #[inline] pub fn set_luminance(&mut self, value: PercentageType) { self.luminance = Some(value); } + #[inline] pub fn get_luminance_modulation(&self) -> Option<&PercentageType> { self.luminance_modulation.as_ref() } + #[inline] pub fn get_luminance_modulation_mut(&mut self) -> Option<&mut PercentageType> { self.luminance_modulation.as_mut() } + #[inline] pub fn set_luminance_modulation(&mut self, value: PercentageType) { self.luminance_modulation = Some(value); } + #[inline] pub fn get_luminance_offset(&self) -> Option<&PercentageType> { self.luminance_offset.as_ref() } + #[inline] pub fn get_luminance_offset_mut(&mut self) -> Option<&mut PercentageType> { self.luminance_offset.as_mut() } + #[inline] pub fn set_luminance_offset(&mut self, value: PercentageType) { self.luminance_offset = Some(value); } + #[inline] pub fn get_saturation(&self) -> Option<&PercentageType> { self.saturation.as_ref() } + #[inline] pub fn get_saturation_mut(&mut self) -> Option<&mut PercentageType> { self.saturation.as_mut() } + #[inline] pub fn set_saturation(&mut self, value: PercentageType) { self.saturation = Some(value); } + #[inline] pub fn get_saturation_modulation(&self) -> Option<&PercentageType> { self.saturation_modulation.as_ref() } + #[inline] pub fn get_saturation_modulation_mut(&mut self) -> Option<&mut PercentageType> { self.saturation_modulation.as_mut() } + #[inline] pub fn set_saturation_modulation(&mut self, value: PercentageType) { self.saturation_modulation = Some(value); } + #[inline] pub fn get_shade(&self) -> Option<&PositiveFixedPercentageType> { self.shade.as_ref() } + #[inline] pub fn get_shade_mut(&mut self) -> Option<&mut PositiveFixedPercentageType> { self.shade.as_mut() } + #[inline] pub fn set_shade(&mut self, value: PositiveFixedPercentageType) { self.shade = Some(value); } + #[inline] pub fn get_alpha(&self) -> Option<&PositiveFixedPercentageType> { self.alpha.as_ref() } + #[inline] pub fn get_alpha_mut(&mut self) -> Option<&mut PositiveFixedPercentageType> { self.alpha.as_mut() } + #[inline] pub fn set_alpha(&mut self, value: PositiveFixedPercentageType) { self.alpha = Some(value); } + #[inline] pub fn get_tint(&self) -> Option<&PositiveFixedPercentageType> { self.tint.as_ref() } + #[inline] pub fn get_tint_mut(&mut self) -> Option<&mut PositiveFixedPercentageType> { self.tint.as_mut() } + #[inline] pub fn set_tint(&mut self, value: PositiveFixedPercentageType) { self.tint = Some(value); } + #[inline] pub(crate) fn with_inner_params(&self) -> bool { self.luminance.is_some() || self.luminance_modulation.is_some() diff --git a/src/structs/drawing/rotation.rs b/src/structs/drawing/rotation.rs index 59da007c..753ec0af 100644 --- a/src/structs/drawing/rotation.rs +++ b/src/structs/drawing/rotation.rs @@ -15,33 +15,40 @@ pub struct Rotation { } impl Rotation { + #[inline] pub fn get_latitude(&self) -> &i32 { self.latitude.get_value() } + #[inline] pub fn set_latitude(&mut self, value: i32) -> &mut Self { self.latitude.set_value(value); self } + #[inline] pub fn get_longitude(&self) -> &i32 { self.longitude.get_value() } + #[inline] pub fn set_longitude(&mut self, value: i32) -> &mut Self { self.longitude.set_value(value); self } + #[inline] pub fn get_revolution(&self) -> &i32 { self.revolution.get_value() } + #[inline] pub fn set_revolution(&mut self, value: i32) -> &mut Self { self.revolution.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, diff --git a/src/structs/drawing/round.rs b/src/structs/drawing/round.rs index 9af0caf0..cb4554cb 100644 --- a/src/structs/drawing/round.rs +++ b/src/structs/drawing/round.rs @@ -8,6 +8,7 @@ use writer::driver::*; #[derive(Clone, Default, Debug)] pub struct Round {} impl Round { + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -15,6 +16,7 @@ impl Round { ) { } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { // a:round write_start_tag(writer, "a:round", vec![], true); diff --git a/src/structs/drawing/run.rs b/src/structs/drawing/run.rs index cca682b2..0ddffd51 100644 --- a/src/structs/drawing/run.rs +++ b/src/structs/drawing/run.rs @@ -13,22 +13,27 @@ pub struct Run { } impl Run { + #[inline] pub fn get_text(&self) -> &str { &self.text } + #[inline] pub fn set_text>(&mut self, value: S) { self.text = value.into().into_boxed_str(); } + #[inline] pub fn get_run_properties(&self) -> &RunProperties { &self.run_properties } + #[inline] pub fn get_run_properties_mut(&mut self) -> &mut RunProperties { &mut self.run_properties } + #[inline] pub fn set_run_properties(&mut self, value: RunProperties) { self.run_properties = value; } diff --git a/src/structs/drawing/run_properties.rs b/src/structs/drawing/run_properties.rs index 59f52d98..daeb9257 100644 --- a/src/structs/drawing/run_properties.rs +++ b/src/structs/drawing/run_properties.rs @@ -37,182 +37,223 @@ pub struct RunProperties { } impl RunProperties { + #[inline] pub fn get_text(&self) -> &str { &self.text } + #[inline] pub fn set_text>(&mut self, value: S) -> &mut Self { self.text = value.into().into_boxed_str(); self } + #[inline] pub fn get_kumimoji(&self) -> &str { self.kumimoji.get_value_str() } + #[inline] pub fn set_kumimoji>(&mut self, value: S) -> &mut Self { self.kumimoji.set_value_string(value.into()); self } + #[inline] pub fn get_language(&self) -> &str { self.language.get_value_str() } + #[inline] pub fn set_language>(&mut self, value: S) -> &mut Self { self.language.set_value_string(value.into()); self } + #[inline] pub fn get_alternative_language(&self) -> &str { self.alternative_language.get_value_str() } + #[inline] pub fn set_alternative_language>(&mut self, value: S) -> &mut Self { self.alternative_language.set_value_string(value.into()); self } + #[inline] pub fn get_bold(&self) -> &str { self.bold.get_value_str() } + #[inline] pub fn set_bold>(&mut self, value: S) -> &mut Self { self.bold.set_value_string(value.into()); self } + #[inline] pub fn get_sz(&self) -> &str { self.sz.get_value_str() } + #[inline] pub fn set_sz>(&mut self, value: S) -> &mut Self { self.sz.set_value_string(value.into()); self } + #[inline] pub fn get_italic(&self) -> &str { self.italic.get_value_str() } + #[inline] pub fn set_italic>(&mut self, value: S) -> &mut Self { self.italic.set_value_string(value.into()); self } + #[inline] pub fn get_capital(&self) -> &TextCapsValues { self.capital.get_value() } + #[inline] pub fn set_capital(&mut self, value: TextCapsValues) -> &mut Self { self.capital.set_value(value); self } + #[inline] pub fn get_spacing(&self) -> &i32 { self.spacing.get_value() } + #[inline] pub fn set_spacing(&mut self, value: i32) -> &mut Self { self.spacing.set_value(value); self } + #[inline] pub fn get_strike(&self) -> &str { self.strike.get_value_str() } + #[inline] pub fn set_strike>(&mut self, value: S) -> &mut Self { self.strike.set_value_string(value.into()); self } + #[inline] pub fn get_solid_fill(&self) -> Option<&SolidFill> { self.solid_fill.as_deref() } + #[inline] pub fn get_solid_fill_mut(&mut self) -> Option<&mut SolidFill> { self.solid_fill.as_deref_mut() } + #[inline] pub fn set_solid_fill(&mut self, value: SolidFill) -> &mut Self { self.solid_fill = Some(Box::new(value)); self } + #[inline] pub fn get_outline(&self) -> Option<&Outline> { self.outline.as_deref() } + #[inline] pub fn get_outline_mut(&mut self) -> Option<&mut Outline> { self.outline.as_deref_mut() } + #[inline] pub fn set_outline(&mut self, value: Outline) -> &mut Self { self.outline = Some(Box::new(value)); self } + #[inline] pub fn get_latin_font(&self) -> Option<&TextFontType> { self.latin_font.as_deref() } + #[inline] pub fn get_latin_font_mut(&mut self) -> Option<&mut TextFontType> { self.latin_font.as_deref_mut() } + #[inline] pub fn set_latin_font(&mut self, value: TextFontType) -> &mut Self { self.latin_font = Some(Box::new(value)); self } + #[inline] pub fn get_east_asian_font(&self) -> Option<&TextFontType> { self.east_asian_font.as_deref() } + #[inline] pub fn get_east_asian_font_mut(&mut self) -> Option<&mut TextFontType> { self.east_asian_font.as_deref_mut() } + #[inline] pub fn set_east_asian_font(&mut self, value: TextFontType) -> &mut Self { self.east_asian_font = Some(Box::new(value)); self } + #[inline] pub fn get_gradient_fill(&self) -> Option<&GradientFill> { self.gradient_fill.as_deref() } + #[inline] pub fn get_gradient_fill_mut(&mut self) -> Option<&mut GradientFill> { self.gradient_fill.as_deref_mut() } + #[inline] pub fn set_gradient_fill(&mut self, value: GradientFill) -> &mut Self { self.gradient_fill = Some(Box::new(value)); self } + #[inline] pub fn get_no_fill(&self) -> Option<&NoFill> { self.no_fill.as_ref() } + #[inline] pub fn get_no_fill_mut(&mut self) -> Option<&mut NoFill> { self.no_fill.as_mut() } + #[inline] pub fn set_no_fill(&mut self, value: NoFill) -> &mut Self { self.no_fill = Some(value); self } + #[inline] pub fn get_effect_list(&self) -> Option<&EffectList> { self.effect_list.as_deref() } + #[inline] pub fn get_effect_list_mut(&mut self) -> Option<&mut EffectList> { self.effect_list.as_deref_mut() } + #[inline] pub fn set_effect_list(&mut self, value: EffectList) -> &mut Self { self.effect_list = Some(Box::new(value)); self @@ -323,14 +364,17 @@ impl RunProperties { ); } + #[inline] pub(crate) fn write_to_rpr(&self, writer: &mut Writer>>) { self.write_to(writer, "a:rPr") } + #[inline] pub(crate) fn write_to_end_para_rpr(&self, writer: &mut Writer>>) { self.write_to(writer, "a:endParaRPr") } + #[inline] pub(crate) fn write_to_def_rpr(&self, writer: &mut Writer>>) { self.write_to(writer, "a:defRPr") } diff --git a/src/structs/drawing/scene_3d_type.rs b/src/structs/drawing/scene_3d_type.rs index e767419c..ff803f00 100644 --- a/src/structs/drawing/scene_3d_type.rs +++ b/src/structs/drawing/scene_3d_type.rs @@ -15,19 +15,23 @@ pub struct Scene3DType { } impl Scene3DType { + #[inline] pub fn get_camera(&self) -> Option<&Camera> { self.camera.as_ref() } + #[inline] pub fn set_camera(&mut self, value: Camera) -> &mut Scene3DType { self.camera = Some(value); self } + #[inline] pub fn get_light_rig(&self) -> Option<&LightRig> { self.light_rig.as_ref() } + #[inline] pub fn set_light_rig(&mut self, value: LightRig) -> &mut Scene3DType { self.light_rig = Some(value); self diff --git a/src/structs/drawing/scheme_color.rs b/src/structs/drawing/scheme_color.rs index e6fcfa19..6c9d0246 100644 --- a/src/structs/drawing/scheme_color.rs +++ b/src/structs/drawing/scheme_color.rs @@ -24,111 +24,138 @@ pub struct SchemeColor { } impl SchemeColor { + #[inline] pub fn get_val(&self) -> &SchemeColorValues { self.val.get_value() } + #[inline] pub fn set_val(&mut self, value: SchemeColorValues) -> &mut Self { self.val.set_value(value); self } + #[inline] pub fn get_luminance(&self) -> Option<&PercentageType> { self.luminance.as_ref() } + #[inline] pub fn get_luminance_mut(&mut self) -> Option<&mut PercentageType> { self.luminance.as_mut() } + #[inline] pub fn set_luminance(&mut self, value: PercentageType) { self.luminance = Some(value); } + #[inline] pub fn get_luminance_modulation(&self) -> Option<&PercentageType> { self.luminance_modulation.as_ref() } + #[inline] pub fn get_luminance_modulation_mut(&mut self) -> Option<&mut PercentageType> { self.luminance_modulation.as_mut() } + #[inline] pub fn set_luminance_modulation(&mut self, value: PercentageType) { self.luminance_modulation = Some(value); } + #[inline] pub fn get_luminance_offset(&self) -> Option<&PercentageType> { self.luminance_offset.as_ref() } + #[inline] pub fn get_luminance_offset_mut(&mut self) -> Option<&mut PercentageType> { self.luminance_offset.as_mut() } + #[inline] pub fn set_luminance_offset(&mut self, value: PercentageType) { self.luminance_offset = Some(value); } + #[inline] pub fn get_saturation(&self) -> Option<&PercentageType> { self.saturation.as_ref() } + #[inline] pub fn get_saturation_mut(&mut self) -> Option<&mut PercentageType> { self.saturation.as_mut() } + #[inline] pub fn set_saturation(&mut self, value: PercentageType) { self.saturation = Some(value); } + #[inline] pub fn get_saturation_modulation(&self) -> Option<&PercentageType> { self.saturation_modulation.as_ref() } + #[inline] pub fn get_saturation_modulation_mut(&mut self) -> Option<&mut PercentageType> { self.saturation_modulation.as_mut() } + #[inline] pub fn set_saturation_modulation(&mut self, value: PercentageType) { self.saturation_modulation = Some(value); } + #[inline] pub fn get_shade(&self) -> Option<&PositiveFixedPercentageType> { self.shade.as_ref() } + #[inline] pub fn get_shade_mut(&mut self) -> Option<&mut PositiveFixedPercentageType> { self.shade.as_mut() } + #[inline] pub fn set_shade(&mut self, value: PositiveFixedPercentageType) { self.shade = Some(value); } + #[inline] pub fn get_alpha(&self) -> Option<&PositiveFixedPercentageType> { self.alpha.as_ref() } + #[inline] pub fn get_alpha_mut(&mut self) -> Option<&mut PositiveFixedPercentageType> { self.alpha.as_mut() } + #[inline] pub fn set_alpha(&mut self, value: PositiveFixedPercentageType) { self.alpha = Some(value); } + #[inline] pub fn get_tint(&self) -> Option<&PositiveFixedPercentageType> { self.tint.as_ref() } + #[inline] pub fn get_tint_mut(&mut self) -> Option<&mut PositiveFixedPercentageType> { self.tint.as_mut() } + #[inline] pub fn set_tint(&mut self, value: PositiveFixedPercentageType) { self.tint = Some(value); } + #[inline] pub(crate) fn with_inner_params(&self) -> bool { self.luminance.is_some() || self.luminance_modulation.is_some() diff --git a/src/structs/drawing/scheme_color_values.rs b/src/structs/drawing/scheme_color_values.rs index 916fbe49..28d6da4a 100644 --- a/src/structs/drawing/scheme_color_values.rs +++ b/src/structs/drawing/scheme_color_values.rs @@ -21,11 +21,13 @@ pub enum SchemeColorValues { Text2, } impl Default for SchemeColorValues { + #[inline] fn default() -> Self { Self::Background1 } } impl EnumTrait for SchemeColorValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::Accent1 => "accent1", @@ -50,6 +52,8 @@ impl EnumTrait for SchemeColorValues { } impl FromStr for SchemeColorValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "accent1" => Ok(Self::Accent1), diff --git a/src/structs/drawing/shape_3d_type.rs b/src/structs/drawing/shape_3d_type.rs index b15b08ca..afe2963a 100644 --- a/src/structs/drawing/shape_3d_type.rs +++ b/src/structs/drawing/shape_3d_type.rs @@ -18,35 +18,43 @@ pub struct Shape3DType { } impl Shape3DType { + #[inline] pub fn get_preset_material(&self) -> &PresetMaterialTypeValues { self.preset_material.get_value() } + #[inline] pub fn set_preset_material(&mut self, value: PresetMaterialTypeValues) -> &mut Shape3DType { self.preset_material.set_value(value); self } + #[inline] pub fn get_bevel_top(&self) -> Option<&BevelTop> { self.bevel_top.as_deref() } + #[inline] pub fn get_bevel_top_mut(&mut self) -> Option<&mut BevelTop> { self.bevel_top.as_deref_mut() } + #[inline] pub fn set_bevel_top(&mut self, value: BevelTop) { self.bevel_top = Some(Box::new(value)); } + #[inline] pub fn get_bevel_bottom(&self) -> Option<&BevelBottom> { self.bevel_bottom.as_deref() } + #[inline] pub fn get_bevel_bottom_mut(&mut self) -> Option<&mut BevelBottom> { self.bevel_bottom.as_deref_mut() } + #[inline] pub fn set_bevel_bottom(&mut self, value: BevelBottom) { self.bevel_bottom = Some(Box::new(value)); } diff --git a/src/structs/drawing/shape_auto_fit.rs b/src/structs/drawing/shape_auto_fit.rs index 33c3b241..ad3c95df 100644 --- a/src/structs/drawing/shape_auto_fit.rs +++ b/src/structs/drawing/shape_auto_fit.rs @@ -8,6 +8,7 @@ use writer::driver::*; #[derive(Clone, Default, Debug)] pub struct ShapeAutoFit {} impl ShapeAutoFit { + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -15,6 +16,7 @@ impl ShapeAutoFit { ) { } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { // a:spAutoFit write_start_tag(writer, "a:spAutoFit", vec![], true); diff --git a/src/structs/drawing/shape_guide.rs b/src/structs/drawing/shape_guide.rs index 99812a6b..9cee985c 100644 --- a/src/structs/drawing/shape_guide.rs +++ b/src/structs/drawing/shape_guide.rs @@ -9,18 +9,22 @@ pub struct ShapeGuide { fmla: Box, } impl ShapeGuide { + #[inline] pub fn get_name(&self) -> &str { &self.name } + #[inline] pub fn set_name>(&mut self, value: S) { self.name = value.into().into_boxed_str(); } + #[inline] pub fn get_fmla(&self) -> &str { &self.fmla } + #[inline] pub fn set_fmla>(&mut self, value: S) { self.fmla = value.into().into_boxed_str(); } diff --git a/src/structs/drawing/soft_edge.rs b/src/structs/drawing/soft_edge.rs index bd027fbf..71cf0299 100644 --- a/src/structs/drawing/soft_edge.rs +++ b/src/structs/drawing/soft_edge.rs @@ -12,15 +12,18 @@ pub struct SoftEdge { radius: Int64Value, } impl SoftEdge { + #[inline] pub fn get_radius(&self) -> &i64 { self.radius.get_value() } + #[inline] pub fn set_radius(&mut self, value: i64) -> &mut SoftEdge { self.radius.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, diff --git a/src/structs/drawing/solid_fill.rs b/src/structs/drawing/solid_fill.rs index 24dd03ae..6661c5ae 100644 --- a/src/structs/drawing/solid_fill.rs +++ b/src/structs/drawing/solid_fill.rs @@ -15,26 +15,32 @@ pub struct SolidFill { } impl SolidFill { + #[inline] pub fn get_scheme_color(&self) -> Option<&SchemeColor> { self.scheme_color.as_deref() } + #[inline] pub fn get_scheme_color_mut(&mut self) -> Option<&mut SchemeColor> { self.scheme_color.as_deref_mut() } + #[inline] pub fn set_scheme_color(&mut self, value: SchemeColor) { self.scheme_color = Some(Box::new(value)); } + #[inline] pub fn get_rgb_color_model_hex(&self) -> Option<&RgbColorModelHex> { self.rgb_color_model_hex.as_deref() } + #[inline] pub fn get_rgb_color_model_hex_mut(&mut self) -> Option<&mut RgbColorModelHex> { self.rgb_color_model_hex.as_deref_mut() } + #[inline] pub fn set_rgb_color_model_hex(&mut self, value: RgbColorModelHex) { self.rgb_color_model_hex = Some(Box::new(value)); } diff --git a/src/structs/drawing/source_rectangle.rs b/src/structs/drawing/source_rectangle.rs index e63d88e1..2da8d9bd 100644 --- a/src/structs/drawing/source_rectangle.rs +++ b/src/structs/drawing/source_rectangle.rs @@ -15,34 +15,42 @@ pub struct SourceRectangle { b: StringValue, } impl SourceRectangle { + #[inline] pub fn set_t>(&mut self, value: S) { self.t.set_value(value); } + #[inline] pub fn get_t(&self) -> Option<&str> { self.t.get_value() } + #[inline] pub fn set_l>(&mut self, value: S) { self.l.set_value(value); } + #[inline] pub fn get_l(&self) -> Option<&str> { self.l.get_value() } + #[inline] pub fn set_r>(&mut self, value: S) { self.r.set_value(value); } + #[inline] pub fn get_r(&self) -> Option<&str> { self.r.get_value() } + #[inline] pub fn set_b>(&mut self, value: S) { self.b.set_value(value); } + #[inline] pub fn get_b(&self) -> Option<&str> { self.b.get_value() } diff --git a/src/structs/drawing/space_after.rs b/src/structs/drawing/space_after.rs index 4474ee9e..913ce0c8 100644 --- a/src/structs/drawing/space_after.rs +++ b/src/structs/drawing/space_after.rs @@ -13,19 +13,23 @@ pub struct SpaceAfter { } impl SpaceAfter { + #[inline] pub fn get_spacing_percent(&self) -> Option<&SpacingPercent> { self.spacing_percent.as_ref() } + #[inline] pub fn get_spacing_percent_mut(&mut self) -> Option<&mut SpacingPercent> { self.spacing_percent.as_mut() } + #[inline] pub fn set_spacing_percent(&mut self, value: SpacingPercent) -> &mut Self { self.spacing_percent = Some(value); self } + #[inline] pub fn remove_spacing_percent(&mut self) { self.spacing_percent = None; } diff --git a/src/structs/drawing/space_before.rs b/src/structs/drawing/space_before.rs index 97ea7b17..8a86e797 100644 --- a/src/structs/drawing/space_before.rs +++ b/src/structs/drawing/space_before.rs @@ -13,19 +13,23 @@ pub struct SpaceBefore { } impl SpaceBefore { + #[inline] pub fn get_spacing_percent(&self) -> Option<&SpacingPercent> { self.spacing_percent.as_ref() } + #[inline] pub fn get_spacing_percent_mut(&mut self) -> Option<&mut SpacingPercent> { self.spacing_percent.as_mut() } + #[inline] pub fn set_spacing_percent(&mut self, value: SpacingPercent) -> &mut Self { self.spacing_percent = Some(value); self } + #[inline] pub fn remove_spacing_percent(&mut self) { self.spacing_percent = None; } diff --git a/src/structs/drawing/spacing_percent.rs b/src/structs/drawing/spacing_percent.rs index 2ef2474f..a9356944 100644 --- a/src/structs/drawing/spacing_percent.rs +++ b/src/structs/drawing/spacing_percent.rs @@ -12,15 +12,18 @@ pub struct SpacingPercent { val: Int32Value, } impl SpacingPercent { + #[inline] pub fn get_val(&self) -> &i32 { self.val.get_value() } + #[inline] pub fn set_val(&mut self, value: i32) -> &mut Self { self.val.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -29,6 +32,7 @@ impl SpacingPercent { self.val.set_value_string(get_attribute(e, b"val").unwrap()); } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { // a:spcPct write_start_tag( diff --git a/src/structs/drawing/spreadsheet/blip_fill.rs b/src/structs/drawing/spreadsheet/blip_fill.rs index 49961818..4f408895 100644 --- a/src/structs/drawing/spreadsheet/blip_fill.rs +++ b/src/structs/drawing/spreadsheet/blip_fill.rs @@ -20,49 +20,60 @@ pub struct BlipFill { } impl BlipFill { + #[inline] pub fn get_rotate_with_shape(&self) -> &bool { self.rotate_with_shape.get_value() } + #[inline] pub fn set_rotate_with_shape(&mut self, value: bool) -> &mut BlipFill { self.rotate_with_shape.set_value(value); self } + #[inline] pub fn get_source_rectangle(&self) -> Option<&SourceRectangle> { self.source_rectangle.as_deref() } + #[inline] pub fn get_source_rectangle_mut(&mut self) -> Option<&mut SourceRectangle> { self.source_rectangle.as_deref_mut() } + #[inline] pub fn set_source_rectangle(&mut self, value: SourceRectangle) -> &mut BlipFill { self.source_rectangle = Some(Box::new(value)); self } + #[inline] pub fn get_blip(&self) -> &Blip { &self.blip } + #[inline] pub fn get_blip_mut(&mut self) -> &mut Blip { &mut self.blip } + #[inline] pub fn set_blip(&mut self, value: Blip) -> &mut BlipFill { self.blip = value; self } + #[inline] pub fn get_stretch(&self) -> &Stretch { &self.stretch } + #[inline] pub fn get_stretch_mut(&mut self) -> &mut Stretch { &mut self.stretch } + #[inline] pub fn set_stretch(&mut self, value: Stretch) -> &mut BlipFill { self.stretch = value; self diff --git a/src/structs/drawing/spreadsheet/connection_shape.rs b/src/structs/drawing/spreadsheet/connection_shape.rs index 1c14742c..d5dccb4e 100644 --- a/src/structs/drawing/spreadsheet/connection_shape.rs +++ b/src/structs/drawing/spreadsheet/connection_shape.rs @@ -20,30 +20,36 @@ pub struct ConnectionShape { } impl ConnectionShape { + #[inline] pub fn get_anchor(&self) -> &Anchor { &self.anchor } + #[inline] pub fn get_anchor_mut(&mut self) -> &mut Anchor { &mut self.anchor } + #[inline] pub fn set_anchor(&mut self, value: Anchor) { self.anchor = value; } + #[inline] pub fn get_non_visual_connection_shape_properties( &self, ) -> &NonVisualConnectionShapeProperties { &self.non_visual_connection_shape_properties } + #[inline] pub fn get_non_visual_connection_shape_properties_mut( &mut self, ) -> &mut NonVisualConnectionShapeProperties { &mut self.non_visual_connection_shape_properties } + #[inline] pub fn set_non_visual_connection_shape_properties( &mut self, value: NonVisualConnectionShapeProperties, @@ -51,26 +57,32 @@ impl ConnectionShape { self.non_visual_connection_shape_properties = value; } + #[inline] pub fn get_shape_properties(&self) -> &ShapeProperties { &self.shape_properties } + #[inline] pub fn get_shape_properties_mut(&mut self) -> &mut ShapeProperties { &mut self.shape_properties } + #[inline] pub fn set_shape_properties(&mut self, value: ShapeProperties) { self.shape_properties = value; } + #[inline] pub fn get_shape_style(&self) -> &ShapeStyle { &self.shape_style } + #[inline] pub fn get_shape_style_mut(&mut self) -> &mut ShapeStyle { &mut self.shape_style } + #[inline] pub fn set_shape_style(&mut self, value: ShapeStyle) { self.shape_style = value; } diff --git a/src/structs/drawing/spreadsheet/edit_as_values.rs b/src/structs/drawing/spreadsheet/edit_as_values.rs index 7665441d..d948c7c6 100644 --- a/src/structs/drawing/spreadsheet/edit_as_values.rs +++ b/src/structs/drawing/spreadsheet/edit_as_values.rs @@ -7,11 +7,13 @@ pub enum EditAsValues { TwoCell, } impl Default for EditAsValues { + #[inline] fn default() -> Self { Self::TwoCell } } impl EnumTrait for EditAsValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::Absolute => "absolute", @@ -22,6 +24,8 @@ impl EnumTrait for EditAsValues { } impl FromStr for EditAsValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "absolute" => Ok(Self::Absolute), diff --git a/src/structs/drawing/spreadsheet/extent.rs b/src/structs/drawing/spreadsheet/extent.rs index 3f9980de..6c6d3563 100644 --- a/src/structs/drawing/spreadsheet/extent.rs +++ b/src/structs/drawing/spreadsheet/extent.rs @@ -14,24 +14,29 @@ pub struct Extent { } impl Extent { + #[inline] pub fn get_cx(&self) -> &i64 { self.cx.get_value() } + #[inline] pub fn set_cx(&mut self, value: i64) -> &mut Extent { self.cx.set_value(value); self } + #[inline] pub fn get_cy(&self) -> &i64 { self.cy.get_value() } + #[inline] pub fn set_cy(&mut self, value: i64) -> &mut Extent { self.cy.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -41,6 +46,7 @@ impl Extent { set_string_from_xml!(self, e, cy, "cy"); } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { // xdr:ext write_start_tag( diff --git a/src/structs/drawing/spreadsheet/from_marker.rs b/src/structs/drawing/spreadsheet/from_marker.rs index 7fc51c2c..24dadfea 100644 --- a/src/structs/drawing/spreadsheet/from_marker.rs +++ b/src/structs/drawing/spreadsheet/from_marker.rs @@ -1,9 +1,9 @@ // xdr:from -use writer::driver::*; -use quick_xml::events::{Event, BytesStart}; -use quick_xml::Writer; +use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; +use quick_xml::Writer; use std::io::Cursor; +use writer::driver::*; #[derive(Clone, Default, Debug)] pub struct FromMarker { @@ -13,85 +13,103 @@ pub struct FromMarker { row_off: usize, } impl FromMarker { - pub fn get_col(&self)-> &usize { + #[inline] + pub fn get_col(&self) -> &usize { &self.col } - pub fn set_col(&mut self, value:usize)-> &mut FromMarker { + #[inline] + pub fn set_col(&mut self, value: usize) -> &mut FromMarker { self.col = value; self } - pub fn get_col_off(&self)-> &usize { + #[inline] + pub fn get_col_off(&self) -> &usize { &self.col_off } - pub fn set_col_off(&mut self, value:usize)-> &mut FromMarker { + #[inline] + pub fn set_col_off(&mut self, value: usize) -> &mut FromMarker { self.col_off = value; self } - pub fn get_row(&self)-> &usize { + #[inline] + pub fn get_row(&self) -> &usize { &self.row } - pub fn set_row(&mut self, value:usize)-> &mut FromMarker { + #[inline] + pub fn set_row(&mut self, value: usize) -> &mut FromMarker { self.row = value; self } - pub fn get_row_off(&self)-> &usize { + #[inline] + pub fn get_row_off(&self) -> &usize { &self.row_off } - pub fn set_row_off(&mut self, value:usize)-> &mut FromMarker { + #[inline] + pub fn set_row_off(&mut self, value: usize) -> &mut FromMarker { self.row_off = value; self } - pub(crate) fn adjustment_insert_row(&mut self, num_rows:&usize) { + #[inline] + pub(crate) fn adjustment_insert_row(&mut self, num_rows: &usize) { self.row += num_rows; } - pub(crate) fn adjustment_insert_column(&mut self, num_cols:&usize) { + #[inline] + pub(crate) fn adjustment_insert_column(&mut self, num_cols: &usize) { self.col += num_cols; } - pub(crate) fn adjustment_remove_row(&mut self, num_rows:&usize) { - self.row = if &self.row > num_rows { self.row - num_rows } else { 1 }; + #[inline] + pub(crate) fn adjustment_remove_row(&mut self, num_rows: &usize) { + self.row = if &self.row > num_rows { + self.row - num_rows + } else { + 1 + }; } - pub(crate) fn adjustment_remove_column(&mut self, num_cols:&usize) { - self.col = if &self.col > num_cols { self.col - num_cols } else { 1 }; + #[inline] + pub(crate) fn adjustment_remove_column(&mut self, num_cols: &usize) { + self.col = if &self.col > num_cols { + self.col - num_cols + } else { + 1 + }; } pub(crate) fn set_attributes( &mut self, - reader:&mut Reader, - _e:&BytesStart, + reader: &mut Reader, + _e: &BytesStart, ) { - let mut string_value:String = String::from(""); + let mut string_value: String = String::from(""); let mut buf = Vec::new(); loop { match reader.read_event_into(&mut buf) { Ok(Event::Text(e)) => string_value = e.unescape_and_decode(&reader).unwrap(), - Ok(Event::End(ref e)) => { - match e.name().into_inner() { - b"xdr:col" => { - self.col = string_value.parse::().unwrap(); - }, - b"xdr:colOff" => { - self.col_off = string_value.parse::().unwrap(); - }, - b"xdr:row" => { - self.row = string_value.parse::().unwrap(); - }, - b"xdr:rowOff" => { - self.row_off = string_value.parse::().unwrap(); - }, - b"xdr:from" => return, - _ => (), + Ok(Event::End(ref e)) => match e.name().into_inner() { + b"xdr:col" => { + self.col = string_value.parse::().unwrap(); + } + b"xdr:colOff" => { + self.col_off = string_value.parse::().unwrap(); + } + b"xdr:row" => { + self.row = string_value.parse::().unwrap(); + } + b"xdr:rowOff" => { + self.row_off = string_value.parse::().unwrap(); } + b"xdr:from" => return, + _ => (), }, Ok(Event::Eof) => panic!("Error: Could not find {} end element", "xdr:from"), Err(e) => panic!("Error at position {}: {:?}", reader.buffer_position(), e), diff --git a/src/structs/drawing/spreadsheet/graphic_frame.rs b/src/structs/drawing/spreadsheet/graphic_frame.rs index 55ee8f28..1cac0740 100644 --- a/src/structs/drawing/spreadsheet/graphic_frame.rs +++ b/src/structs/drawing/spreadsheet/graphic_frame.rs @@ -21,25 +21,30 @@ pub struct GraphicFrame { } impl GraphicFrame { + #[inline] pub fn get_macro(&self) -> &str { self.r#macro.get_value_str() } + #[inline] pub fn set_macro>(&mut self, value: S) -> &mut GraphicFrame { self.r#macro.set_value(value); self } + #[inline] pub fn get_non_visual_graphic_frame_properties(&self) -> &NonVisualGraphicFrameProperties { &self.non_visual_graphic_frame_properties } + #[inline] pub fn get_non_visual_graphic_frame_properties_mut( &mut self, ) -> &mut NonVisualGraphicFrameProperties { &mut self.non_visual_graphic_frame_properties } + #[inline] pub fn set_non_visual_graphic_frame_properties( &mut self, value: NonVisualGraphicFrameProperties, @@ -48,27 +53,33 @@ impl GraphicFrame { self } + #[inline] pub fn get_transform(&self) -> &Transform { &self.transform } + #[inline] pub fn get_transform_mut(&mut self) -> &mut Transform { &mut self.transform } + #[inline] pub fn set_transform(&mut self, value: Transform) -> &mut Self { self.transform = value; self } + #[inline] pub fn get_graphic(&self) -> &Graphic { &self.graphic } + #[inline] pub fn get_graphic_mut(&mut self) -> &mut Graphic { &mut self.graphic } + #[inline] pub fn set_graphic(&mut self, value: Graphic) -> &mut Self { self.graphic = value; self @@ -135,6 +146,7 @@ impl GraphicFrame { } } impl AdjustmentCoordinateWithSheet for GraphicFrame { + #[inline] fn adjustment_insert_coordinate_with_sheet( &mut self, sheet_name: &str, @@ -152,6 +164,7 @@ impl AdjustmentCoordinateWithSheet for GraphicFrame { ); } + #[inline] fn adjustment_remove_coordinate_with_sheet( &mut self, sheet_name: &str, diff --git a/src/structs/drawing/spreadsheet/group_shape.rs b/src/structs/drawing/spreadsheet/group_shape.rs index 3e4c67bd..a775f003 100644 --- a/src/structs/drawing/spreadsheet/group_shape.rs +++ b/src/structs/drawing/spreadsheet/group_shape.rs @@ -21,52 +21,64 @@ pub struct GroupShape { } impl GroupShape { + #[inline] pub fn get_non_visual_group_shape_properties(&self) -> &NonVisualGroupShapeProperties { &self.non_visual_group_shape_properties } + #[inline] pub fn get_non_visual_group_shape_properties_mut( &mut self, ) -> &mut NonVisualGroupShapeProperties { &mut self.non_visual_group_shape_properties } + #[inline] pub fn set_non_visual_group_shape_properties(&mut self, value: NonVisualGroupShapeProperties) { self.non_visual_group_shape_properties = value; } + #[inline] pub fn get_group_shape_properties(&self) -> &GroupShapeProperties { &self.group_shape_properties } + #[inline] pub fn get_group_shape_properties_mut(&mut self) -> &mut GroupShapeProperties { &mut self.group_shape_properties } + #[inline] pub fn set_group_shape_properties(&mut self, value: GroupShapeProperties) { self.group_shape_properties = value; } + #[inline] pub fn get_picture_collection(&self) -> &[Picture] { &self.picture_collection } + #[inline] pub fn get_picture_collection_mut(&mut self) -> &mut ThinVec { &mut self.picture_collection } + #[inline] pub fn add_picture_collection(&mut self, value: Picture) { self.picture_collection.push(value); } + #[inline] pub fn get_shape_collection(&self) -> &[Shape] { &self.shape_collection } + #[inline] pub fn get_shape_collection_mut(&mut self) -> &mut ThinVec { &mut self.shape_collection } + #[inline] pub fn add_shape_collection(&mut self, value: Shape) { self.shape_collection.push(value); } diff --git a/src/structs/drawing/spreadsheet/group_shape_properties.rs b/src/structs/drawing/spreadsheet/group_shape_properties.rs index 579be3e4..e9d4c702 100644 --- a/src/structs/drawing/spreadsheet/group_shape_properties.rs +++ b/src/structs/drawing/spreadsheet/group_shape_properties.rs @@ -13,14 +13,17 @@ pub struct GroupShapeProperties { } impl GroupShapeProperties { + #[inline] pub fn get_transform2d(&self) -> Option<&Transform2D> { self.transform2d.as_ref() } + #[inline] pub fn get_transform2d_mut(&mut self) -> Option<&mut Transform2D> { self.transform2d.as_mut() } + #[inline] pub fn set_transform2d(&mut self, value: Transform2D) -> &mut Self { self.transform2d = Some(value); self diff --git a/src/structs/drawing/spreadsheet/marker_type.rs b/src/structs/drawing/spreadsheet/marker_type.rs index 4d6ec694..2ddcc13b 100644 --- a/src/structs/drawing/spreadsheet/marker_type.rs +++ b/src/structs/drawing/spreadsheet/marker_type.rs @@ -15,56 +15,68 @@ pub struct MarkerType { row_off: i32, } impl MarkerType { + #[inline] pub fn get_col(&self) -> &u32 { &self.col } + #[inline] pub fn set_col(&mut self, value: u32) -> &mut Self { self.col = value; self } + #[inline] pub fn get_col_off(&self) -> &i32 { &self.col_off } + #[inline] pub fn set_col_off(&mut self, value: i32) -> &mut Self { self.col_off = value; self } + #[inline] pub fn add_col_off(&mut self, value: i32) -> &mut Self { self.col_off += value; self } + #[inline] pub fn get_row(&self) -> &u32 { &self.row } + #[inline] pub fn set_row(&mut self, value: u32) -> &mut Self { self.row = value; self } + #[inline] pub fn get_row_off(&self) -> &i32 { &self.row_off } + #[inline] pub fn set_row_off(&mut self, value: i32) -> &mut Self { self.row_off = value; self } + #[inline] pub fn add_row_off(&mut self, value: i32) -> &mut Self { self.row_off += value; self } + #[inline] pub fn get_coordinate(&self) -> String { coordinate_from_index(&(&self.col + 1), &(&self.row + 1)) } + #[inline] pub fn set_coordinate>(&mut self, value: S) { let (col, row, ..) = index_from_coordinate(value.into()); self.col = col.unwrap() - 1; @@ -105,10 +117,12 @@ impl MarkerType { buf.clear(); } } + #[inline] pub(crate) fn write_to_from(&self, writer: &mut Writer>>) { self.write_to(writer, "xdr:from"); } + #[inline] pub(crate) fn write_to_to(&self, writer: &mut Writer>>) { self.write_to(writer, "xdr:to"); } @@ -141,6 +155,7 @@ impl MarkerType { } } impl AdjustmentCoordinate for MarkerType { + #[inline] fn adjustment_insert_coordinate( &mut self, root_col_num: &u32, @@ -152,6 +167,7 @@ impl AdjustmentCoordinate for MarkerType { self.row = adjustment_insert_coordinate(&(&self.row + 1), root_row_num, offset_row_num) - 1; } + #[inline] fn adjustment_remove_coordinate( &mut self, root_col_num: &u32, @@ -163,6 +179,7 @@ impl AdjustmentCoordinate for MarkerType { self.row = adjustment_remove_coordinate(&(&self.row + 1), root_row_num, offset_row_num) - 1; } + #[inline] fn is_remove_coordinate( &self, root_col_num: &u32, diff --git a/src/structs/drawing/spreadsheet/non_visual_connection_shape_properties.rs b/src/structs/drawing/spreadsheet/non_visual_connection_shape_properties.rs index c1984744..37d4f051 100644 --- a/src/structs/drawing/spreadsheet/non_visual_connection_shape_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_connection_shape_properties.rs @@ -15,14 +15,17 @@ pub struct NonVisualConnectionShapeProperties { } impl NonVisualConnectionShapeProperties { + #[inline] pub fn get_non_visual_drawing_properties(&self) -> &NonVisualDrawingProperties { &self.non_visual_drawing_properties } + #[inline] pub fn get_non_visual_drawing_properties_mut(&mut self) -> &mut NonVisualDrawingProperties { &mut self.non_visual_drawing_properties } + #[inline] pub fn set_non_visual_drawing_properties( &mut self, value: NonVisualDrawingProperties, @@ -31,18 +34,21 @@ impl NonVisualConnectionShapeProperties { self } + #[inline] pub fn get_non_visual_connector_shape_drawing_properties( &self, ) -> &NonVisualConnectorShapeDrawingProperties { &self.non_visual_connector_shape_drawing_properties } + #[inline] pub fn get_non_visual_connector_shape_drawing_properties_mut( &mut self, ) -> &mut NonVisualConnectorShapeDrawingProperties { &mut self.non_visual_connector_shape_drawing_properties } + #[inline] pub fn set_non_visual_connector_shape_drawing_properties( &mut self, value: NonVisualConnectorShapeDrawingProperties, diff --git a/src/structs/drawing/spreadsheet/non_visual_connector_shape_drawing_properties.rs b/src/structs/drawing/spreadsheet/non_visual_connector_shape_drawing_properties.rs index b855eeac..00739968 100644 --- a/src/structs/drawing/spreadsheet/non_visual_connector_shape_drawing_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_connector_shape_drawing_properties.rs @@ -15,26 +15,32 @@ pub struct NonVisualConnectorShapeDrawingProperties { } impl NonVisualConnectorShapeDrawingProperties { + #[inline] pub fn get_start_connection(&self) -> Option<&StartConnection> { self.start_connection.as_deref() } + #[inline] pub fn set_start_connection(&mut self, value: StartConnection) { self.start_connection = Some(Box::new(value)); } + #[inline] pub fn remove_start_connection(&mut self) { self.start_connection = None; } + #[inline] pub fn get_end_connection(&self) -> Option<&EndConnection> { self.end_connection.as_deref() } + #[inline] pub fn set_end_connection(&mut self, value: EndConnection) { self.end_connection = Some(Box::new(value)); } + #[inline] pub fn remove_end_connection(&mut self) { self.end_connection = None; } diff --git a/src/structs/drawing/spreadsheet/non_visual_drawing_properties.rs b/src/structs/drawing/spreadsheet/non_visual_drawing_properties.rs index 397f7aea..c1859284 100644 --- a/src/structs/drawing/spreadsheet/non_visual_drawing_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_drawing_properties.rs @@ -17,28 +17,34 @@ pub struct NonVisualDrawingProperties { } impl NonVisualDrawingProperties { + #[inline] pub fn get_id(&self) -> &u32 { self.id.get_value() } + #[inline] pub fn set_id(&mut self, value: u32) -> &mut Self { self.id.set_value(value); self } + #[inline] pub fn get_name(&self) -> &str { self.name.get_value_str() } + #[inline] pub fn set_name>(&mut self, value: S) -> &mut Self { self.name.set_value(value); self } + #[inline] pub fn get_hidden(&self) -> &bool { self.hidden.get_value() } + #[inline] pub fn set_hidden(&mut self, value: bool) -> &mut Self { self.hidden.set_value(value); self diff --git a/src/structs/drawing/spreadsheet/non_visual_graphic_frame_drawing_properties.rs b/src/structs/drawing/spreadsheet/non_visual_graphic_frame_drawing_properties.rs index 8e1ebe8a..cfd9b306 100644 --- a/src/structs/drawing/spreadsheet/non_visual_graphic_frame_drawing_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_graphic_frame_drawing_properties.rs @@ -8,6 +8,7 @@ use writer::driver::*; #[derive(Clone, Default, Debug)] pub struct NonVisualGraphicFrameDrawingProperties {} impl NonVisualGraphicFrameDrawingProperties { + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -15,6 +16,7 @@ impl NonVisualGraphicFrameDrawingProperties { ) { } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { // xdr:cNvGraphicFramePr write_start_tag(writer, "xdr:cNvGraphicFramePr", vec![], true); diff --git a/src/structs/drawing/spreadsheet/non_visual_graphic_frame_properties.rs b/src/structs/drawing/spreadsheet/non_visual_graphic_frame_properties.rs index e9010593..f69a86c1 100644 --- a/src/structs/drawing/spreadsheet/non_visual_graphic_frame_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_graphic_frame_properties.rs @@ -15,14 +15,17 @@ pub struct NonVisualGraphicFrameProperties { } impl NonVisualGraphicFrameProperties { + #[inline] pub fn get_non_visual_drawing_properties(&self) -> &NonVisualDrawingProperties { &self.non_visual_drawing_properties } + #[inline] pub fn get_non_visual_drawing_properties_mut(&mut self) -> &mut NonVisualDrawingProperties { &mut self.non_visual_drawing_properties } + #[inline] pub fn set_non_visual_drawing_properties( &mut self, value: NonVisualDrawingProperties, @@ -31,18 +34,21 @@ impl NonVisualGraphicFrameProperties { self } + #[inline] pub fn get_non_visual_graphic_frame_drawing_properties( &self, ) -> &NonVisualGraphicFrameDrawingProperties { &self.non_visual_graphic_frame_drawing_properties } + #[inline] pub fn get_non_visual_graphic_frame_drawing_properties_mut( &mut self, ) -> &mut NonVisualGraphicFrameDrawingProperties { &mut self.non_visual_graphic_frame_drawing_properties } + #[inline] pub fn set_non_visual_graphic_frame_drawing_properties( &mut self, value: NonVisualGraphicFrameDrawingProperties, diff --git a/src/structs/drawing/spreadsheet/non_visual_group_shape_drawing_properties.rs b/src/structs/drawing/spreadsheet/non_visual_group_shape_drawing_properties.rs index 39dcf0ad..ccaf5c7a 100644 --- a/src/structs/drawing/spreadsheet/non_visual_group_shape_drawing_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_group_shape_drawing_properties.rs @@ -14,14 +14,17 @@ pub struct NonVisualGroupShapeDrawingProperties { } impl NonVisualGroupShapeDrawingProperties { + #[inline] pub fn get_group_shape_locks(&self) -> Option<&GroupShapeLocks> { self.group_shape_locks.as_ref() } + #[inline] pub fn get_group_shape_locks_mut(&mut self) -> Option<&mut GroupShapeLocks> { self.group_shape_locks.as_mut() } + #[inline] pub fn set_group_shape_locks(&mut self, value: GroupShapeLocks) -> &mut Self { self.group_shape_locks = Some(value); self diff --git a/src/structs/drawing/spreadsheet/non_visual_group_shape_properties.rs b/src/structs/drawing/spreadsheet/non_visual_group_shape_properties.rs index 0900de02..d69ff393 100644 --- a/src/structs/drawing/spreadsheet/non_visual_group_shape_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_group_shape_properties.rs @@ -15,14 +15,17 @@ pub struct NonVisualGroupShapeProperties { } impl NonVisualGroupShapeProperties { + #[inline] pub fn get_non_visual_drawing_properties(&self) -> &NonVisualDrawingProperties { &self.non_visual_drawing_properties } + #[inline] pub fn get_non_visual_drawing_properties_mut(&mut self) -> &mut NonVisualDrawingProperties { &mut self.non_visual_drawing_properties } + #[inline] pub fn set_non_visual_drawing_properties( &mut self, value: NonVisualDrawingProperties, @@ -31,18 +34,21 @@ impl NonVisualGroupShapeProperties { self } + #[inline] pub fn get_non_visual_group_shape_drawing_properties( &self, ) -> &NonVisualGroupShapeDrawingProperties { &self.non_visual_group_shape_drawing_properties } + #[inline] pub fn get_non_visual_group_shape_drawing_properties_mut( &mut self, ) -> &mut NonVisualGroupShapeDrawingProperties { &mut self.non_visual_group_shape_drawing_properties } + #[inline] pub fn set_non_visual_group_shape_drawing_properties( &mut self, value: NonVisualGroupShapeDrawingProperties, diff --git a/src/structs/drawing/spreadsheet/non_visual_picture_drawing_properties.rs b/src/structs/drawing/spreadsheet/non_visual_picture_drawing_properties.rs index edb20268..bbc14ef8 100644 --- a/src/structs/drawing/spreadsheet/non_visual_picture_drawing_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_picture_drawing_properties.rs @@ -15,22 +15,27 @@ pub struct NonVisualPictureDrawingProperties { } impl NonVisualPictureDrawingProperties { + #[inline] pub fn get_prefer_relative_resize(&self) -> &bool { self.prefer_relative_resize.get_value() } + #[inline] pub fn set_prefer_relative_resize(&mut self, value: bool) { self.prefer_relative_resize.set_value(value); } + #[inline] pub fn get_picture_locks(&self) -> Option<&PictureLocks> { self.picture_locks.as_ref() } + #[inline] pub fn get_picture_locks_mut(&mut self) -> Option<&mut PictureLocks> { self.picture_locks.as_mut() } + #[inline] pub fn set_picture_locks(&mut self, value: PictureLocks) { self.picture_locks = Some(value); } diff --git a/src/structs/drawing/spreadsheet/non_visual_picture_properties.rs b/src/structs/drawing/spreadsheet/non_visual_picture_properties.rs index cd93e27a..e34190d0 100644 --- a/src/structs/drawing/spreadsheet/non_visual_picture_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_picture_properties.rs @@ -15,28 +15,34 @@ pub struct NonVisualPictureProperties { } impl NonVisualPictureProperties { + #[inline] pub fn get_non_visual_drawing_properties(&self) -> &NonVisualDrawingProperties { &self.non_visual_drawing_properties } + #[inline] pub fn get_non_visual_drawing_properties_mut(&mut self) -> &mut NonVisualDrawingProperties { &mut self.non_visual_drawing_properties } + #[inline] pub fn set_non_visual_drawing_properties(&mut self, value: NonVisualDrawingProperties) { self.non_visual_drawing_properties = value; } + #[inline] pub fn get_non_visual_picture_drawing_properties(&self) -> &NonVisualPictureDrawingProperties { &self.non_visual_picture_drawing_properties } + #[inline] pub fn get_non_visual_picture_drawing_properties_mut( &mut self, ) -> &mut NonVisualPictureDrawingProperties { &mut self.non_visual_picture_drawing_properties } + #[inline] pub fn set_non_visual_picture_drawing_properties( &mut self, value: NonVisualPictureDrawingProperties, diff --git a/src/structs/drawing/spreadsheet/non_visual_shape_properties.rs b/src/structs/drawing/spreadsheet/non_visual_shape_properties.rs index 62323c75..dee78365 100644 --- a/src/structs/drawing/spreadsheet/non_visual_shape_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_shape_properties.rs @@ -13,14 +13,17 @@ pub struct NonVisualShapeProperties { } impl NonVisualShapeProperties { + #[inline] pub fn get_non_visual_drawing_properties(&self) -> &NonVisualDrawingProperties { &self.non_visual_drawing_properties } + #[inline] pub fn get_non_visual_drawing_properties_mut(&mut self) -> &mut NonVisualDrawingProperties { &mut self.non_visual_drawing_properties } + #[inline] pub fn set_non_visual_drawing_properties(&mut self, value: NonVisualDrawingProperties) { self.non_visual_drawing_properties = value; } diff --git a/src/structs/drawing/spreadsheet/one_cell_anchor.rs b/src/structs/drawing/spreadsheet/one_cell_anchor.rs index 73ee00b0..3e4c6f56 100644 --- a/src/structs/drawing/spreadsheet/one_cell_anchor.rs +++ b/src/structs/drawing/spreadsheet/one_cell_anchor.rs @@ -23,71 +23,87 @@ pub struct OneCellAnchor { } impl OneCellAnchor { + #[inline] pub fn get_from_marker(&self) -> &MarkerType { &self.from_marker } + #[inline] pub fn get_from_marker_mut(&mut self) -> &mut MarkerType { &mut self.from_marker } + #[inline] pub fn set_from_marker(&mut self, value: MarkerType) -> &mut OneCellAnchor { self.from_marker = value; self } + #[inline] pub fn get_extent(&self) -> &Extent { &self.extent } + #[inline] pub fn get_extent_mut(&mut self) -> &mut Extent { &mut self.extent } + #[inline] pub fn set_extent(&mut self, value: Extent) -> &mut OneCellAnchor { self.extent = value; self } + #[inline] pub fn get_group_shape(&self) -> Option<&GroupShape> { self.group_shape.as_deref() } + #[inline] pub fn get_group_shape_mut(&mut self) -> Option<&mut GroupShape> { self.group_shape.as_deref_mut() } + #[inline] pub fn set_group_shape(&mut self, value: GroupShape) -> &mut Self { self.group_shape = Some(Box::new(value)); self } + #[inline] pub fn get_shape(&self) -> Option<&Shape> { self.shape.as_deref() } + #[inline] pub fn get_shape_mut(&mut self) -> Option<&mut Shape> { self.shape.as_deref_mut() } + #[inline] pub fn set_shape(&mut self, value: Shape) -> &mut OneCellAnchor { self.shape = Some(Box::new(value)); self } + #[inline] pub fn get_picture(&self) -> Option<&Picture> { self.picture.as_deref() } + #[inline] pub fn get_picture_mut(&mut self) -> Option<&mut Picture> { self.picture.as_deref_mut() } + #[inline] pub fn set_picture(&mut self, value: Picture) -> &mut Self { self.picture = Some(Box::new(value)); self } + #[inline] pub(crate) fn is_image(&self) -> bool { self.picture.is_some() || self.group_shape.is_some() } @@ -173,6 +189,7 @@ impl OneCellAnchor { } } impl AdjustmentCoordinate for OneCellAnchor { + #[inline] fn adjustment_insert_coordinate( &mut self, root_col_num: &u32, @@ -188,6 +205,7 @@ impl AdjustmentCoordinate for OneCellAnchor { ); } + #[inline] fn adjustment_remove_coordinate( &mut self, root_col_num: &u32, @@ -203,6 +221,7 @@ impl AdjustmentCoordinate for OneCellAnchor { ); } + #[inline] fn is_remove_coordinate( &self, root_col_num: &u32, diff --git a/src/structs/drawing/spreadsheet/picture.rs b/src/structs/drawing/spreadsheet/picture.rs index be14285e..c02de014 100644 --- a/src/structs/drawing/spreadsheet/picture.rs +++ b/src/structs/drawing/spreadsheet/picture.rs @@ -18,38 +18,47 @@ pub struct Picture { } impl Picture { + #[inline] pub fn get_non_visual_picture_properties(&self) -> &NonVisualPictureProperties { &self.non_visual_picture_properties } + #[inline] pub fn get_non_visual_picture_properties_mut(&mut self) -> &mut NonVisualPictureProperties { &mut self.non_visual_picture_properties } + #[inline] pub fn set_non_visual_picture_properties(&mut self, value: NonVisualPictureProperties) { self.non_visual_picture_properties = value; } + #[inline] pub fn get_blip_fill(&self) -> &BlipFill { &self.blip_fill } + #[inline] pub fn get_blip_fill_mut(&mut self) -> &mut BlipFill { &mut self.blip_fill } + #[inline] pub fn set_blip_fill(&mut self, value: BlipFill) { self.blip_fill = value; } + #[inline] pub fn get_shape_properties(&self) -> &ShapeProperties { &self.shape_properties } + #[inline] pub fn get_shape_properties_mut(&mut self) -> &mut ShapeProperties { &mut self.shape_properties } + #[inline] pub fn set_shape_properties(&mut self, value: ShapeProperties) { self.shape_properties = value; } diff --git a/src/structs/drawing/spreadsheet/shape.rs b/src/structs/drawing/spreadsheet/shape.rs index f25cca5c..03cbedbe 100644 --- a/src/structs/drawing/spreadsheet/shape.rs +++ b/src/structs/drawing/spreadsheet/shape.rs @@ -22,18 +22,22 @@ pub struct Shape { } impl Shape { + #[inline] pub fn get_anchor(&self) -> &Anchor { &self.anchor } + #[inline] pub fn get_anchor_mut(&mut self) -> &mut Anchor { &mut self.anchor } + #[inline] pub fn set_anchor(&mut self, value: Anchor) { self.anchor = value; } + #[inline] pub fn get_non_visual_shape_properties(&self) -> &NonVisualShapeProperties { &self.non_visual_shape_properties } @@ -42,18 +46,22 @@ impl Shape { &mut self.non_visual_shape_properties } + #[inline] pub fn set_non_visual_shape_properties(&mut self, value: NonVisualShapeProperties) { self.non_visual_shape_properties = value; } + #[inline] pub fn get_shape_properties(&self) -> &ShapeProperties { &self.shape_properties } + #[inline] pub fn get_shape_properties_mut(&mut self) -> &mut ShapeProperties { &mut self.shape_properties } + #[inline] pub fn set_shape_properties(&mut self, value: ShapeProperties) { self.shape_properties = value; } @@ -62,22 +70,27 @@ impl Shape { self.shape_style.as_deref() } + #[inline] pub fn get_shape_style_mut(&mut self) -> Option<&mut ShapeStyle> { self.shape_style.as_deref_mut() } + #[inline] pub fn set_shape_style(&mut self, value: ShapeStyle) { self.shape_style = Some(Box::new(value)); } + #[inline] pub fn get_text_body(&self) -> Option<&TextBody> { self.text_body.as_deref() } + #[inline] pub fn get_text_body_mut(&mut self) -> Option<&mut TextBody> { self.text_body.as_deref_mut() } + #[inline] pub fn set_text_body(&mut self, value: TextBody) { self.text_body = Some(Box::new(value)); } diff --git a/src/structs/drawing/spreadsheet/shape_properties.rs b/src/structs/drawing/spreadsheet/shape_properties.rs index 1f1101ee..6713056b 100644 --- a/src/structs/drawing/spreadsheet/shape_properties.rs +++ b/src/structs/drawing/spreadsheet/shape_properties.rs @@ -27,105 +27,129 @@ pub struct ShapeProperties { extension_list: Option, } impl ShapeProperties { + #[inline] pub fn get_transform2d(&self) -> Option<&Transform2D> { self.transform2d.as_deref() } + #[inline] pub fn get_transform2d_mut(&mut self) -> Option<&mut Transform2D> { self.transform2d.as_deref_mut() } + #[inline] pub fn set_transform2d(&mut self, value: Transform2D) -> &mut Self { self.transform2d = Some(Box::new(value)); self } + #[inline] pub fn get_geometry(&self) -> &PresetGeometry { &self.preset_geometry } + #[inline] pub fn get_geometry_mut(&mut self) -> &mut PresetGeometry { &mut self.preset_geometry } + #[inline] pub fn set_geometry(&mut self, value: PresetGeometry) -> &mut Self { self.preset_geometry = value; self } + #[inline] pub fn get_blip_fill(&self) -> Option<&BlipFill> { self.blip_fill.as_deref() } + #[inline] pub fn get_blip_fill_mut(&mut self) -> Option<&mut BlipFill> { self.blip_fill.as_deref_mut() } + #[inline] pub fn set_blip_fill(&mut self, value: BlipFill) -> &mut Self { self.blip_fill = Some(Box::new(value)); self } + #[inline] pub fn get_solid_fill(&self) -> Option<&SolidFill> { self.solid_fill.as_deref() } + #[inline] pub fn get_solid_fill_mut(&mut self) -> Option<&mut SolidFill> { self.solid_fill.as_deref_mut() } + #[inline] pub fn set_solid_fill(&mut self, value: SolidFill) -> &mut Self { self.solid_fill = Some(Box::new(value)); self } + #[inline] pub fn get_outline(&self) -> Option<&Outline> { self.outline.as_deref() } + #[inline] pub fn get_outline_mut(&mut self) -> Option<&mut Outline> { self.outline.as_deref_mut() } + #[inline] pub fn set_outline(&mut self, value: Outline) -> &mut Self { self.outline = Some(Box::new(value)); self } + #[inline] pub fn get_effect_list(&self) -> Option<&EffectList> { self.effect_list.as_deref() } + #[inline] pub fn get_effect_list_mut(&mut self) -> Option<&mut EffectList> { self.effect_list.as_deref_mut() } + #[inline] pub fn set_effect_list(&mut self, value: EffectList) -> &mut Self { self.effect_list = Some(Box::new(value)); self } + #[inline] pub fn get_no_fill(&self) -> Option<&NoFill> { self.no_fill.as_ref() } + #[inline] pub fn get_no_fill_mut(&mut self) -> Option<&mut NoFill> { self.no_fill.as_mut() } + #[inline] pub fn set_no_fill(&mut self, value: NoFill) -> &mut Self { self.no_fill = Some(value); self } + #[inline] pub fn get_extension_list(&self) -> Option<&ExtensionList> { self.extension_list.as_ref() } + #[inline] pub fn get_extension_list_mut(&mut self) -> Option<&mut ExtensionList> { self.extension_list.as_mut() } + #[inline] pub fn set_extension_list(&mut self, value: ExtensionList) -> &mut Self { self.extension_list = Some(value); self diff --git a/src/structs/drawing/spreadsheet/shape_style.rs b/src/structs/drawing/spreadsheet/shape_style.rs index 9302af99..3c0c7897 100644 --- a/src/structs/drawing/spreadsheet/shape_style.rs +++ b/src/structs/drawing/spreadsheet/shape_style.rs @@ -16,34 +16,42 @@ pub struct ShapeStyle { } impl ShapeStyle { + #[inline] pub fn get_line_reference(&self) -> Option<&StyleMatrixReferenceType> { self.line_reference.as_deref() } + #[inline] pub fn set_line_reference(&mut self, value: StyleMatrixReferenceType) { self.line_reference = Some(Box::new(value)); } + #[inline] pub fn get_fill_reference(&self) -> Option<&StyleMatrixReferenceType> { self.fill_reference.as_deref() } + #[inline] pub fn set_fill_reference(&mut self, value: StyleMatrixReferenceType) { self.fill_reference = Some(Box::new(value)); } + #[inline] pub fn get_effect_reference(&self) -> Option<&StyleMatrixReferenceType> { self.effect_reference.as_deref() } + #[inline] pub fn set_effect_reference(&mut self, value: StyleMatrixReferenceType) { self.effect_reference = Some(Box::new(value)); } + #[inline] pub fn get_font_reference(&self) -> Option<&StyleMatrixReferenceType> { self.font_reference.as_deref() } + #[inline] pub fn set_font_reference(&mut self, value: StyleMatrixReferenceType) { self.font_reference = Some(Box::new(value)); } diff --git a/src/structs/drawing/spreadsheet/text_body.rs b/src/structs/drawing/spreadsheet/text_body.rs index bc6c2e40..6872def7 100644 --- a/src/structs/drawing/spreadsheet/text_body.rs +++ b/src/structs/drawing/spreadsheet/text_body.rs @@ -17,38 +17,47 @@ pub struct TextBody { } impl TextBody { + #[inline] pub fn get_body_properties(&self) -> &BodyProperties { &self.body_properties } + #[inline] pub fn get_body_properties_mut(&mut self) -> &mut BodyProperties { &mut self.body_properties } + #[inline] pub fn set_body_properties(&mut self, value: BodyProperties) { self.body_properties = value; } + #[inline] pub fn get_list_style(&self) -> &ListStyle { &self.list_style } + #[inline] pub fn get_list_style_mut(&mut self) -> &mut ListStyle { &mut self.list_style } + #[inline] pub fn set_list_style(&mut self, value: ListStyle) { self.list_style = value; } + #[inline] pub fn get_paragraph(&self) -> &[Paragraph] { &self.paragraph } + #[inline] pub fn get_paragraph_mut(&mut self) -> &mut ThinVec { &mut self.paragraph } + #[inline] pub fn add_paragraph(&mut self, value: Paragraph) { self.paragraph.push(value); } diff --git a/src/structs/drawing/spreadsheet/to_marker.rs b/src/structs/drawing/spreadsheet/to_marker.rs index 856f69c8..7ce46a97 100644 --- a/src/structs/drawing/spreadsheet/to_marker.rs +++ b/src/structs/drawing/spreadsheet/to_marker.rs @@ -1,9 +1,9 @@ // xdr:to -use writer::driver::*; -use quick_xml::events::{Event, BytesStart}; -use quick_xml::Writer; +use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; +use quick_xml::Writer; use std::io::Cursor; +use writer::driver::*; #[derive(Clone, Default, Debug)] pub struct ToMarker { @@ -13,85 +13,103 @@ pub struct ToMarker { row_off: usize, } impl ToMarker { - pub fn get_col(&self)-> &usize { + #[inline] + pub fn get_col(&self) -> &usize { &self.col } - pub fn set_col(&mut self, value:usize)-> &mut ToMarker { + #[inline] + pub fn set_col(&mut self, value: usize) -> &mut ToMarker { self.col = value; self } - pub fn get_col_off(&self)-> &usize { + #[inline] + pub fn get_col_off(&self) -> &usize { &self.col_off } - pub fn set_col_off(&mut self, value:usize)-> &mut ToMarker { + #[inline] + pub fn set_col_off(&mut self, value: usize) -> &mut ToMarker { self.col_off = value; self } - pub fn get_row(&self)-> &usize { + #[inline] + pub fn get_row(&self) -> &usize { &self.row } - pub fn set_row(&mut self, value:usize)-> &mut ToMarker { + #[inline] + pub fn set_row(&mut self, value: usize) -> &mut ToMarker { self.row = value; self } - pub fn get_row_off(&self)-> &usize { + #[inline] + pub fn get_row_off(&self) -> &usize { &self.row_off } - pub fn set_row_off(&mut self, value:usize)-> &mut ToMarker { + #[inline] + pub fn set_row_off(&mut self, value: usize) -> &mut ToMarker { self.row_off = value; self } - pub(crate) fn adjustment_insert_row(&mut self, num_rows:&usize) { + #[inline] + pub(crate) fn adjustment_insert_row(&mut self, num_rows: &usize) { self.row += num_rows; } - pub(crate) fn adjustment_insert_column(&mut self, num_cols:&usize) { + #[inline] + pub(crate) fn adjustment_insert_column(&mut self, num_cols: &usize) { self.col += num_cols; } - pub(crate) fn adjustment_remove_row(&mut self, num_rows:&usize) { - self.row = if &self.row > num_rows { self.row - num_rows } else { 1 }; + #[inline] + pub(crate) fn adjustment_remove_row(&mut self, num_rows: &usize) { + self.row = if &self.row > num_rows { + self.row - num_rows + } else { + 1 + }; } - pub(crate) fn adjustment_remove_column(&mut self, num_cols:&usize) { - self.col = if &self.col > num_cols { self.col - num_cols } else { 1 }; + #[inline] + pub(crate) fn adjustment_remove_column(&mut self, num_cols: &usize) { + self.col = if &self.col > num_cols { + self.col - num_cols + } else { + 1 + }; } pub(crate) fn set_attributes( &mut self, - reader:&mut Reader, - _e:&BytesStart, + reader: &mut Reader, + _e: &BytesStart, ) { - let mut string_value:String = String::from(""); + let mut string_value: String = String::from(""); let mut buf = Vec::new(); loop { match reader.read_event_into(&mut buf) { Ok(Event::Text(e)) => string_value = e.unescape_and_decode(&reader).unwrap(), - Ok(Event::End(ref e)) => { - match e.name().into_inner() { - b"xdr:col" => { - self.col = string_value.parse::().unwrap(); - }, - b"xdr:colOff" => { - self.col_off = string_value.parse::().unwrap(); - }, - b"xdr:row" => { - self.row = string_value.parse::().unwrap(); - }, - b"xdr:rowOff" => { - self.row_off = string_value.parse::().unwrap(); - }, - b"xdr:to" => return, - _ => (), + Ok(Event::End(ref e)) => match e.name().into_inner() { + b"xdr:col" => { + self.col = string_value.parse::().unwrap(); + } + b"xdr:colOff" => { + self.col_off = string_value.parse::().unwrap(); + } + b"xdr:row" => { + self.row = string_value.parse::().unwrap(); + } + b"xdr:rowOff" => { + self.row_off = string_value.parse::().unwrap(); } + b"xdr:to" => return, + _ => (), }, Ok(Event::Eof) => panic!("Error: Could not find {} end element", "xdr:to"), Err(e) => panic!("Error at position {}: {:?}", reader.buffer_position(), e), diff --git a/src/structs/drawing/spreadsheet/transform.rs b/src/structs/drawing/spreadsheet/transform.rs index 4db22341..44698bbe 100644 --- a/src/structs/drawing/spreadsheet/transform.rs +++ b/src/structs/drawing/spreadsheet/transform.rs @@ -18,52 +18,64 @@ pub struct Transform { } impl Transform { + #[inline] pub fn get_offset(&self) -> &Offset { &self.offset } + #[inline] pub fn get_offset_mut(&mut self) -> &mut Offset { &mut self.offset } + #[inline] pub fn set_offset(&mut self, value: Offset) -> &mut Transform { self.offset = value; self } + #[inline] pub fn get_extents(&self) -> &Extents { &self.extents } + #[inline] pub fn get_extents_mut(&mut self) -> &mut Extents { &mut self.extents } + #[inline] pub fn set_extents(&mut self, value: Extents) -> &mut Transform { self.extents = value; self } + #[inline] pub fn get_rotation(&self) -> &i32 { self.rotation.get_value() } + #[inline] pub fn set_rotation(&mut self, value: i32) { self.rotation.set_value(value); } + #[inline] pub fn get_vertical_flip(&self) -> &bool { self.vertical_flip.get_value() } + #[inline] pub fn set_vertical_flip(&mut self, value: bool) { self.vertical_flip.set_value(value); } + #[inline] pub fn get_horizontal_flip(&self) -> &bool { self.horizontal_flip.get_value() } + #[inline] pub fn set_horizontal_flip(&mut self, value: bool) { self.horizontal_flip.set_value(value); } diff --git a/src/structs/drawing/spreadsheet/two_cell_anchor.rs b/src/structs/drawing/spreadsheet/two_cell_anchor.rs index 34e4604e..6d28c1fb 100644 --- a/src/structs/drawing/spreadsheet/two_cell_anchor.rs +++ b/src/structs/drawing/spreadsheet/two_cell_anchor.rs @@ -34,115 +34,141 @@ pub struct TwoCellAnchor { } impl TwoCellAnchor { + #[inline] pub fn get_edit_as(&self) -> &EditAsValues { self.edit_as.get_value() } + #[inline] pub fn set_edit_as(&mut self, value: EditAsValues) -> &mut Self { self.edit_as.set_value(value); self } + #[inline] pub fn get_from_marker(&self) -> &MarkerType { &self.from_marker } + #[inline] pub fn get_from_marker_mut(&mut self) -> &mut MarkerType { &mut self.from_marker } + #[inline] pub fn set_from_marker(&mut self, value: MarkerType) -> &mut Self { self.from_marker = value; self } + #[inline] pub fn get_to_marker(&self) -> &MarkerType { &self.to_marker } + #[inline] pub fn get_to_marker_mut(&mut self) -> &mut MarkerType { &mut self.to_marker } + #[inline] pub fn set_to_marker(&mut self, value: MarkerType) -> &mut Self { self.to_marker = value; self } + #[inline] pub fn get_group_shape(&self) -> Option<&GroupShape> { self.group_shape.as_deref() } + #[inline] pub fn get_group_shape_mut(&mut self) -> Option<&mut GroupShape> { self.group_shape.as_deref_mut() } + #[inline] pub fn set_group_shape(&mut self, value: GroupShape) -> &mut Self { self.group_shape = Some(Box::new(value)); self } + #[inline] pub fn get_graphic_frame(&self) -> Option<&GraphicFrame> { self.graphic_frame.as_deref() } + #[inline] pub fn get_graphic_frame_mut(&mut self) -> Option<&mut GraphicFrame> { self.graphic_frame.as_deref_mut() } + #[inline] pub fn set_graphic_frame(&mut self, value: GraphicFrame) -> &mut Self { self.graphic_frame = Some(Box::new(value)); self } + #[inline] pub fn get_shape(&self) -> Option<&Shape> { self.shape.as_deref() } + #[inline] pub fn get_shape_mut(&mut self) -> Option<&mut Shape> { self.shape.as_deref_mut() } + #[inline] pub fn set_shape(&mut self, value: Shape) -> &mut Self { self.shape = Some(Box::new(value)); self } + #[inline] pub fn get_connection_shape(&self) -> Option<&ConnectionShape> { self.connection_shape.as_deref() } + #[inline] pub fn get_connection_shape_mut(&mut self) -> Option<&mut ConnectionShape> { self.connection_shape.as_deref_mut() } + #[inline] pub fn set_connection_shape(&mut self, value: ConnectionShape) -> &mut Self { self.connection_shape = Some(Box::new(value)); self } + #[inline] pub fn get_picture(&self) -> Option<&Picture> { self.picture.as_deref() } + #[inline] pub fn get_picture_mut(&mut self) -> Option<&mut Picture> { self.picture.as_deref_mut() } + #[inline] pub fn set_picture(&mut self, value: Picture) -> &mut Self { self.picture = Some(Box::new(value)); self } + #[inline] pub fn get_is_alternate_content(&self) -> &bool { self.is_alternate_content.get_value() } + #[inline] pub fn set_is_alternate_content(&mut self, value: bool) -> &mut Self { self.is_alternate_content.set_value(value); self } + #[inline] pub(crate) fn is_support(&self) -> bool { self.graphic_frame.as_ref().map_or(true, |v| { v.get_graphic() @@ -154,10 +180,12 @@ impl TwoCellAnchor { }) } + #[inline] pub(crate) fn is_chart(&self) -> bool { self.graphic_frame.is_some() } + #[inline] pub(crate) fn is_image(&self) -> bool { self.picture.is_some() || self.group_shape.is_some() } @@ -295,6 +323,7 @@ impl TwoCellAnchor { } } impl AdjustmentCoordinate for TwoCellAnchor { + #[inline] fn adjustment_insert_coordinate( &mut self, root_col_num: &u32, @@ -316,6 +345,7 @@ impl AdjustmentCoordinate for TwoCellAnchor { ); } + #[inline] fn adjustment_remove_coordinate( &mut self, root_col_num: &u32, @@ -337,6 +367,7 @@ impl AdjustmentCoordinate for TwoCellAnchor { ); } + #[inline] fn is_remove_coordinate( &self, root_col_num: &u32, @@ -358,6 +389,7 @@ impl AdjustmentCoordinate for TwoCellAnchor { } } impl AdjustmentCoordinateWithSheet for TwoCellAnchor { + #[inline] fn adjustment_insert_coordinate_with_sheet( &mut self, sheet_name: &str, @@ -380,6 +412,7 @@ impl AdjustmentCoordinateWithSheet for TwoCellAnchor { } } + #[inline] fn adjustment_remove_coordinate_with_sheet( &mut self, sheet_name: &str, diff --git a/src/structs/drawing/spreadsheet/worksheet_drawing.rs b/src/structs/drawing/spreadsheet/worksheet_drawing.rs index c6af5697..130323f2 100644 --- a/src/structs/drawing/spreadsheet/worksheet_drawing.rs +++ b/src/structs/drawing/spreadsheet/worksheet_drawing.rs @@ -29,25 +29,30 @@ pub struct WorksheetDrawing { } impl WorksheetDrawing { + #[inline] pub fn get_image_collection(&self) -> &[Image] { &self.image_collection } + #[inline] pub fn get_image_collection_mut(&mut self) -> &mut ThinVec { &mut self.image_collection } + #[inline] pub fn add_image(&mut self, value: Image) -> &mut Self { self.image_collection.push(value); self } + #[inline] pub fn get_image(&self, col: &u32, row: &u32) -> Option<&Image> { self.image_collection .iter() .find(|&image| image.get_col() == &(col - 1) && image.get_row() == &(row - 1)) } + #[inline] pub fn get_image_mut(&mut self, col: &u32, row: &u32) -> Option<&mut Image> { self.image_collection .iter_mut() @@ -74,25 +79,30 @@ impl WorksheetDrawing { result } + #[inline] pub fn get_chart_collection(&self) -> &[Chart] { &self.chart_collection } + #[inline] pub fn get_chart_collection_mut(&mut self) -> &mut ThinVec { &mut self.chart_collection } + #[inline] pub fn add_chart_collection(&mut self, value: Chart) -> &mut Self { self.chart_collection.push(value); self } + #[inline] pub fn get_chart(&self, col: &u32, row: &u32) -> Option<&Chart> { self.chart_collection .iter() .find(|&chart| chart.get_col() == &(col - 1) && chart.get_row() == &(row - 1)) } + #[inline] pub fn get_chart_mut(&mut self, col: &u32, row: &u32) -> Option<&mut Chart> { self.chart_collection .iter_mut() @@ -119,32 +129,39 @@ impl WorksheetDrawing { result } + #[inline] pub fn get_one_cell_anchor_collection(&self) -> &[OneCellAnchor] { &self.one_cell_anchor_collection } + #[inline] pub fn get_one_cell_anchor_collection_mut(&mut self) -> &mut ThinVec { &mut self.one_cell_anchor_collection } + #[inline] pub fn add_one_cell_anchor_collection(&mut self, value: OneCellAnchor) -> &mut Self { self.one_cell_anchor_collection.push(value); self } + #[inline] pub fn get_two_cell_anchor_collection(&self) -> &[TwoCellAnchor] { &self.two_cell_anchor_collection } + #[inline] pub fn get_two_cell_anchor_collection_mut(&mut self) -> &mut ThinVec { &mut self.two_cell_anchor_collection } + #[inline] pub fn add_two_cell_anchor_collection(&mut self, value: TwoCellAnchor) -> &mut Self { self.two_cell_anchor_collection.push(value); self } + #[inline] pub fn has_drawing_object(&self) -> bool { !self.chart_collection.is_empty() || !self.image_collection.is_empty() diff --git a/src/structs/drawing/start_connection.rs b/src/structs/drawing/start_connection.rs index b38b93d7..541a2598 100644 --- a/src/structs/drawing/start_connection.rs +++ b/src/structs/drawing/start_connection.rs @@ -13,22 +13,27 @@ pub struct StartConnection { index: UInt32Value, } impl StartConnection { + #[inline] pub fn get_id(&self) -> &u32 { self.id.get_value() } + #[inline] pub fn set_id(&mut self, value: u32) { self.id.set_value(value); } + #[inline] pub fn get_index(&self) -> &u32 { self.index.get_value() } + #[inline] pub fn set_index(&mut self, value: u32) { self.index.set_value(value); } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -39,6 +44,7 @@ impl StartConnection { .set_value_string(get_attribute(e, b"idx").unwrap()); } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { write_start_tag( writer, diff --git a/src/structs/drawing/stretch.rs b/src/structs/drawing/stretch.rs index f4b76ee0..43223930 100644 --- a/src/structs/drawing/stretch.rs +++ b/src/structs/drawing/stretch.rs @@ -13,14 +13,17 @@ pub struct Stretch { } impl Stretch { + #[inline] pub fn get_fill_rectangle(&self) -> Option<&FillRectangle> { self.fill_rectangle.as_deref() } + #[inline] pub fn get_fill_rectangle_mut(&mut self) -> Option<&mut FillRectangle> { self.fill_rectangle.as_deref_mut() } + #[inline] pub fn set_fill_rectangle(&mut self, value: FillRectangle) { self.fill_rectangle = Some(Box::new(value)); } diff --git a/src/structs/drawing/style_matrix_reference_type.rs b/src/structs/drawing/style_matrix_reference_type.rs index 69e53157..741882ed 100644 --- a/src/structs/drawing/style_matrix_reference_type.rs +++ b/src/structs/drawing/style_matrix_reference_type.rs @@ -14,18 +14,22 @@ pub struct StyleMatrixReferenceType { } impl StyleMatrixReferenceType { + #[inline] pub fn get_index(&self) -> &str { &self.index } + #[inline] pub fn set_index>(&mut self, value: S) { self.index = value.into().into_boxed_str(); } + #[inline] pub fn get_scheme_color(&self) -> Option<&SchemeColor> { self.scheme_color.as_deref() } + #[inline] pub fn set_scheme_color(&mut self, value: SchemeColor) { self.scheme_color = Some(Box::new(value)); } diff --git a/src/structs/drawing/supplemental_font.rs b/src/structs/drawing/supplemental_font.rs index 1c145945..6ea98e82 100644 --- a/src/structs/drawing/supplemental_font.rs +++ b/src/structs/drawing/supplemental_font.rs @@ -14,24 +14,29 @@ pub struct SupplementalFont { } impl SupplementalFont { + #[inline] pub fn get_script(&self) -> &str { self.script.get_value_str() } + #[inline] pub fn set_script>(&mut self, value: S) -> &mut Self { self.script.set_value(value); self } + #[inline] pub fn get_typeface(&self) -> &str { self.typeface.get_value_str() } + #[inline] pub fn set_typeface>(&mut self, value: S) -> &mut Self { self.typeface.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, diff --git a/src/structs/drawing/system_color.rs b/src/structs/drawing/system_color.rs index 504bf389..adad81e8 100644 --- a/src/structs/drawing/system_color.rs +++ b/src/structs/drawing/system_color.rs @@ -16,23 +16,28 @@ pub struct SystemColor { } impl SystemColor { + #[inline] pub fn get_val(&self) -> &SystemColorValues { self.val.get_value() } + #[inline] pub fn set_val(&mut self, value: SystemColorValues) -> &mut Self { self.val.set_value(value); self } + #[inline] pub fn get_last_color(&self) -> &str { self.last_color.get_value_str() } + #[inline] pub fn set_last_color>(&mut self, value: S) { self.last_color.set_value(value.into()); } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, diff --git a/src/structs/drawing/system_color_values.rs b/src/structs/drawing/system_color_values.rs index 914b03be..685c17ac 100644 --- a/src/structs/drawing/system_color_values.rs +++ b/src/structs/drawing/system_color_values.rs @@ -34,11 +34,13 @@ pub enum SystemColorValues { WindowText, } impl Default for SystemColorValues { + #[inline] fn default() -> Self { Self::ScrollBar } } impl EnumTrait for SystemColorValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::ActiveBorder => "activeBorder", @@ -76,6 +78,8 @@ impl EnumTrait for SystemColorValues { } impl FromStr for SystemColorValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "activeBorder" => Ok(Self::ActiveBorder), diff --git a/src/structs/drawing/tail_end.rs b/src/structs/drawing/tail_end.rs index 6e86cbd1..522867a8 100644 --- a/src/structs/drawing/tail_end.rs +++ b/src/structs/drawing/tail_end.rs @@ -15,26 +15,32 @@ pub struct TailEnd { } impl TailEnd { + #[inline] pub fn get_type(&self) -> &str { self.t_type.get_value_str() } + #[inline] pub fn set_type>(&mut self, value: S) { self.t_type.set_value(value.into()); } + #[inline] pub fn get_width(&self) -> &str { self.width.get_value_str() } + #[inline] pub fn set_width>(&mut self, value: S) { self.width.set_value(value.into()); } + #[inline] pub fn get_length(&self) -> &str { self.length.get_value_str() } + #[inline] pub fn set_length>(&mut self, value: S) { self.length.set_value(value.into()); } diff --git a/src/structs/drawing/text_alignment_type_values.rs b/src/structs/drawing/text_alignment_type_values.rs index 88c4f5e9..f49f4f09 100644 --- a/src/structs/drawing/text_alignment_type_values.rs +++ b/src/structs/drawing/text_alignment_type_values.rs @@ -11,11 +11,13 @@ pub enum TextAlignmentTypeValues { ThaiDistributed, } impl Default for TextAlignmentTypeValues { + #[inline] fn default() -> Self { Self::Left } } impl EnumTrait for TextAlignmentTypeValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::Center => "ctr", @@ -30,6 +32,8 @@ impl EnumTrait for TextAlignmentTypeValues { } impl FromStr for TextAlignmentTypeValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "ctr" => Ok(Self::Center), diff --git a/src/structs/drawing/text_caps_values.rs b/src/structs/drawing/text_caps_values.rs index e34eb03e..3c067e56 100644 --- a/src/structs/drawing/text_caps_values.rs +++ b/src/structs/drawing/text_caps_values.rs @@ -7,11 +7,13 @@ pub enum TextCapsValues { Small, } impl Default for TextCapsValues { + #[inline] fn default() -> Self { Self::None } } impl EnumTrait for TextCapsValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::All => "all", @@ -22,6 +24,8 @@ impl EnumTrait for TextCapsValues { } impl FromStr for TextCapsValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "all" => Ok(Self::All), diff --git a/src/structs/drawing/text_font_alignment_values.rs b/src/structs/drawing/text_font_alignment_values.rs index 67c82527..071bfa39 100644 --- a/src/structs/drawing/text_font_alignment_values.rs +++ b/src/structs/drawing/text_font_alignment_values.rs @@ -9,11 +9,13 @@ pub enum TextFontAlignmentValues { Top, } impl Default for TextFontAlignmentValues { + #[inline] fn default() -> Self { Self::Automatic } } impl EnumTrait for TextFontAlignmentValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::Automatic => "auto", @@ -26,6 +28,8 @@ impl EnumTrait for TextFontAlignmentValues { } impl FromStr for TextFontAlignmentValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "auto" => Ok(Self::Automatic), diff --git a/src/structs/drawing/text_font_type.rs b/src/structs/drawing/text_font_type.rs index ea6e83da..10d24ed8 100644 --- a/src/structs/drawing/text_font_type.rs +++ b/src/structs/drawing/text_font_type.rs @@ -15,37 +15,45 @@ pub struct TextFontType { } impl TextFontType { + #[inline] pub fn get_typeface(&self) -> &str { self.typeface.get_value_str() } + #[inline] pub fn set_typeface>(&mut self, value: S) -> &mut Self { self.typeface.set_value(value.into()); self } + #[inline] pub fn get_pitch_family(&self) -> &str { self.pitch_family.get_value_str() } + #[inline] pub fn set_pitch_family>(&mut self, value: S) -> &mut Self { self.pitch_family.set_value(value.into()); self } + #[inline] pub fn get_charset(&self) -> &str { self.charset.get_value_str() } + #[inline] pub fn set_charset>(&mut self, value: S) -> &mut Self { self.charset.set_value(value.into()); self } + #[inline] pub fn get_panose(&self) -> &str { self.panose.get_value_str() } + #[inline] pub fn set_panose>(&mut self, value: S) -> &mut Self { self.panose.set_value(value.into()); self @@ -70,14 +78,17 @@ impl TextFontType { } } + #[inline] pub(crate) fn write_to_latin(&self, writer: &mut Writer>>) { self.write_to(writer, "a:latin"); } + #[inline] pub(crate) fn write_to_cs(&self, writer: &mut Writer>>) { self.write_to(writer, "a:cs"); } + #[inline] pub(crate) fn write_to_ea(&self, writer: &mut Writer>>) { self.write_to(writer, "a:ea"); } diff --git a/src/structs/drawing/text_paragraph_properties_type.rs b/src/structs/drawing/text_paragraph_properties_type.rs index 61cac147..8b377a64 100644 --- a/src/structs/drawing/text_paragraph_properties_type.rs +++ b/src/structs/drawing/text_paragraph_properties_type.rs @@ -23,67 +23,82 @@ pub struct TextParagraphPropertiesType { default_run_properties: Option>, } impl TextParagraphPropertiesType { + #[inline] pub fn get_right_to_left(&self) -> &bool { self.right_to_left.get_value() } + #[inline] pub fn set_right_to_left(&mut self, value: bool) -> &mut Self { self.right_to_left.set_value(value); self } + #[inline] pub fn get_alignment(&self) -> &TextAlignmentTypeValues { self.alignment.get_value() } + #[inline] pub fn set_alignment(&mut self, value: TextAlignmentTypeValues) -> &mut Self { self.alignment.set_value(value); self } + #[inline] pub fn get_font_alignment(&self) -> &TextFontAlignmentValues { self.font_alignment.get_value() } + #[inline] pub fn set_font_alignment(&mut self, value: TextFontAlignmentValues) -> &mut Self { self.font_alignment.set_value(value); self } + #[inline] pub fn get_space_before(&self) -> Option<&SpaceBefore> { self.space_before.as_ref() } + #[inline] pub fn get_space_before_mut(&mut self) -> Option<&mut SpaceBefore> { self.space_before.as_mut() } + #[inline] pub fn set_space_before(&mut self, value: SpaceBefore) -> &mut Self { self.space_before = Some(value); self } + #[inline] pub fn get_space_after(&self) -> Option<&SpaceAfter> { self.space_after.as_ref() } + #[inline] pub fn get_space_after_mut(&mut self) -> Option<&mut SpaceAfter> { self.space_after.as_mut() } + #[inline] pub fn set_space_after(&mut self, value: SpaceAfter) -> &mut Self { self.space_after = Some(value); self } + #[inline] pub fn get_default_run_properties(&self) -> Option<&RunProperties> { self.default_run_properties.as_deref() } + #[inline] pub fn get_default_run_properties_mut(&mut self) -> Option<&mut RunProperties> { self.default_run_properties.as_deref_mut() } + #[inline] pub fn set_default_run_properties(&mut self, value: RunProperties) -> &mut Self { self.default_run_properties = Some(Box::new(value)); self @@ -149,42 +164,52 @@ impl TextParagraphPropertiesType { ); } + #[inline] pub(crate) fn write_to_default(&self, writer: &mut Writer>>) { self.write_to(writer, "a:defPPr") } + #[inline] pub(crate) fn write_to_lvl1(&self, writer: &mut Writer>>) { self.write_to(writer, "a:lvl1pPr") } + #[inline] pub(crate) fn write_to_lvl2(&self, writer: &mut Writer>>) { self.write_to(writer, "a:lvl2pPr") } + #[inline] pub(crate) fn write_to_lvl3(&self, writer: &mut Writer>>) { self.write_to(writer, "a:lvl3pPr") } + #[inline] pub(crate) fn write_to_lvl4(&self, writer: &mut Writer>>) { self.write_to(writer, "a:lvl4pPr") } + #[inline] pub(crate) fn write_to_lvl5(&self, writer: &mut Writer>>) { self.write_to(writer, "a:lvl5pPr") } + #[inline] pub(crate) fn write_to_lvl6(&self, writer: &mut Writer>>) { self.write_to(writer, "a:lvl6pPr") } + #[inline] pub(crate) fn write_to_lvl7(&self, writer: &mut Writer>>) { self.write_to(writer, "a:lvl7pPr") } + #[inline] pub(crate) fn write_to_lvl8(&self, writer: &mut Writer>>) { self.write_to(writer, "a:lvl8pPr") } + #[inline] pub(crate) fn write_to_lvl9(&self, writer: &mut Writer>>) { self.write_to(writer, "a:lvl9pPr") } diff --git a/src/structs/drawing/text_wrapping_values.rs b/src/structs/drawing/text_wrapping_values.rs index 60b6ebce..ee6a18d8 100644 --- a/src/structs/drawing/text_wrapping_values.rs +++ b/src/structs/drawing/text_wrapping_values.rs @@ -6,11 +6,13 @@ pub enum TextWrappingValues { Square, } impl Default for TextWrappingValues { + #[inline] fn default() -> Self { Self::None } } impl EnumTrait for TextWrappingValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::None => "none", @@ -20,6 +22,8 @@ impl EnumTrait for TextWrappingValues { } impl FromStr for TextWrappingValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "none" => Ok(Self::None), diff --git a/src/structs/drawing/theme.rs b/src/structs/drawing/theme.rs index fe859c4e..4b494fec 100644 --- a/src/structs/drawing/theme.rs +++ b/src/structs/drawing/theme.rs @@ -34,23 +34,28 @@ pub struct Theme { } impl Theme { + #[inline] pub fn get_name(&self) -> &str { self.name.get_value_str() } + #[inline] pub fn set_name>(&mut self, value: S) -> &mut Self { self.name.set_value(value); self } + #[inline] pub fn get_theme_elements(&self) -> &ThemeElements { &self.theme_elements } + #[inline] pub fn get_theme_elements_mut(&mut self) -> &mut ThemeElements { &mut self.theme_elements } + #[inline] pub fn set_theme_elements(&mut self, value: ThemeElements) -> &mut Self { self.theme_elements = value; self diff --git a/src/structs/drawing/theme_elements.rs b/src/structs/drawing/theme_elements.rs index 6786a5b4..e167e44d 100644 --- a/src/structs/drawing/theme_elements.rs +++ b/src/structs/drawing/theme_elements.rs @@ -17,38 +17,47 @@ pub struct ThemeElements { } impl ThemeElements { + #[inline] pub fn set_color_scheme(&mut self, value: ColorScheme) { self.color_scheme = value; } + #[inline] pub fn get_color_scheme(&self) -> &ColorScheme { &self.color_scheme } + #[inline] pub fn get_color_scheme_mut(&mut self) -> &mut ColorScheme { &mut self.color_scheme } + #[inline] pub fn set_font_scheme(&mut self, value: FontScheme) { self.font_scheme = value; } + #[inline] pub fn get_font_scheme(&self) -> &FontScheme { &self.font_scheme } + #[inline] pub fn get_font_scheme_mut(&mut self) -> &mut FontScheme { &mut self.font_scheme } + #[inline] pub fn set_format_scheme(&mut self, value: FormatScheme) { self.format_scheme = value; } + #[inline] pub fn get_format_scheme(&self) -> &FormatScheme { &self.format_scheme } + #[inline] pub fn get_format_scheme_mut(&mut self) -> &mut FormatScheme { &mut self.format_scheme } diff --git a/src/structs/drawing/tile_flip_values.rs b/src/structs/drawing/tile_flip_values.rs index 1ec33f66..eb4f61fb 100644 --- a/src/structs/drawing/tile_flip_values.rs +++ b/src/structs/drawing/tile_flip_values.rs @@ -8,11 +8,13 @@ pub enum TileFlipValues { Vertical, } impl Default for TileFlipValues { + #[inline] fn default() -> Self { Self::None } } impl EnumTrait for TileFlipValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::Horizontal => "x", @@ -24,6 +26,8 @@ impl EnumTrait for TileFlipValues { } impl FromStr for TileFlipValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "x" => Ok(Self::Horizontal), diff --git a/src/structs/drawing/tile_rectangle.rs b/src/structs/drawing/tile_rectangle.rs index 362a954f..ba31936d 100644 --- a/src/structs/drawing/tile_rectangle.rs +++ b/src/structs/drawing/tile_rectangle.rs @@ -8,6 +8,7 @@ use writer::driver::*; #[derive(Clone, Default, Debug)] pub struct TileRectangle {} impl TileRectangle { + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -15,6 +16,7 @@ impl TileRectangle { ) { } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { // a:tileRect write_start_tag(writer, "a:tileRect", vec![], true); diff --git a/src/structs/drawing/transform2d.rs b/src/structs/drawing/transform2d.rs index 0078a805..293c4699 100644 --- a/src/structs/drawing/transform2d.rs +++ b/src/structs/drawing/transform2d.rs @@ -21,74 +21,92 @@ pub struct Transform2D { } impl Transform2D { + #[inline] pub fn get_offset(&self) -> &Point2DType { &self.offset } + #[inline] pub fn get_offset_mut(&mut self) -> &mut Point2DType { &mut self.offset } + #[inline] pub fn set_offset(&mut self, value: Point2DType) { self.offset = value; } + #[inline] pub fn get_extents(&self) -> &PositiveSize2DType { &self.extents } + #[inline] pub fn get_extents_mut(&mut self) -> &mut PositiveSize2DType { &mut self.extents } + #[inline] pub fn set_extents(&mut self, value: PositiveSize2DType) { self.extents = value; } + #[inline] pub fn get_child_offset(&self) -> Option<&Point2DType> { self.child_offset.as_deref() } + #[inline] pub fn get_child_offset_mut(&mut self) -> Option<&mut Point2DType> { self.child_offset.as_deref_mut() } + #[inline] pub fn set_child_offset(&mut self, value: Point2DType) { self.child_offset = Some(Box::new(value)); } + #[inline] pub fn get_child_extents(&self) -> Option<&PositiveSize2DType> { self.child_extents.as_deref() } + #[inline] pub fn get_child_extents_mut(&mut self) -> Option<&mut PositiveSize2DType> { self.child_extents.as_deref_mut() } + #[inline] pub fn set_child_extents(&mut self, value: PositiveSize2DType) { self.child_extents = Some(Box::new(value)); } + #[inline] pub fn get_rot(&self) -> Option<&str> { self.rot.get_value() } + #[inline] pub fn set_rot>(&mut self, value: S) { self.rot.set_value(value); } + #[inline] pub fn get_flip_v(&self) -> Option<&str> { self.flip_v.get_value() } + #[inline] pub fn set_flip_v>(&mut self, value: S) { self.flip_v.set_value(value); } + #[inline] pub fn get_flip_h(&self) -> Option<&str> { self.flip_h.get_value() } + #[inline] pub fn set_flip_h>(&mut self, value: S) { self.flip_h.set_value(value); } diff --git a/src/structs/embedded_object_properties.rs b/src/structs/embedded_object_properties.rs index 4003c943..5f831d68 100644 --- a/src/structs/embedded_object_properties.rs +++ b/src/structs/embedded_object_properties.rs @@ -22,62 +22,76 @@ pub struct EmbeddedObjectProperties { } impl EmbeddedObjectProperties { + #[inline] pub fn get_prog_id(&self) -> &str { self.prog_id.get_value_str() } + #[inline] pub fn set_prog_id>(&mut self, value: S) -> &mut Self { self.prog_id.set_value(value); self } + #[inline] pub fn get_shape_id(&self) -> &u32 { self.shape_id.get_value() } + #[inline] pub fn set_shape_id(&mut self, value: u32) -> &mut Self { self.shape_id.set_value(value); self } + #[inline] pub fn get_image(&self) -> &MediaObject { &self.image } + #[inline] pub fn get_image_mut(&mut self) -> &mut MediaObject { &mut self.image } + #[inline] pub fn set_image(&mut self, value: MediaObject) { self.image = value; } + #[inline] pub fn get_default_size(&self) -> &bool { self.default_size.get_value() } + #[inline] pub fn set_default_size(&mut self, value: bool) -> &mut Self { self.default_size.set_value(value); self } + #[inline] pub fn get_auto_pict(&self) -> &bool { self.auto_pict.get_value() } + #[inline] pub fn set_auto_pict(&mut self, value: bool) -> &mut Self { self.auto_pict.set_value(value); self } + #[inline] pub fn get_object_anchor(&self) -> &ObjectAnchor { &self.object_anchor } + #[inline] pub fn get_object_anchor_mut(&mut self) -> &mut ObjectAnchor { &mut self.object_anchor } + #[inline] pub fn set_object_anchor(&mut self, value: ObjectAnchor) -> &mut Self { self.object_anchor = value; self diff --git a/src/structs/enum_value.rs b/src/structs/enum_value.rs index 800e3839..91df1701 100644 --- a/src/structs/enum_value.rs +++ b/src/structs/enum_value.rs @@ -8,6 +8,7 @@ pub struct EnumValue { } impl EnumValue { + #[inline] pub(crate) fn get_value(&self) -> &T { match &self.value { Some(v) => v, @@ -15,15 +16,18 @@ impl EnumValue { } } + #[inline] pub(crate) fn get_value_string(&self) -> &str { self.get_value().get_value_string() } + #[inline] pub(crate) fn set_value(&mut self, value: T) -> &mut EnumValue { self.value = Some(value); self } + #[inline] pub(crate) fn set_value_string>(&mut self, value: S) -> &mut EnumValue { if let Ok(v) = T::from_str(value.into().as_str()) { self.set_value(v); @@ -31,10 +35,12 @@ impl EnumValue { self } + #[inline] pub(crate) fn has_value(&self) -> bool { self.value.is_some() } + #[inline] pub(crate) fn get_hash_string(&self) -> &str { if self.has_value() { return self.get_value_string(); diff --git a/src/structs/error.rs b/src/structs/error.rs index d36d355c..dbf3c8af 100644 --- a/src/structs/error.rs +++ b/src/structs/error.rs @@ -25,6 +25,7 @@ pub enum CellErrorType { } impl fmt::Display for CellErrorType { + #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { match *self { CellErrorType::Div0 => write!(f, "#DIV/0!"), @@ -40,6 +41,8 @@ impl fmt::Display for CellErrorType { } impl FromStr for CellErrorType { type Err = XlsxError; + + #[inline] fn from_str(s: &str) -> Result { match s { "#DIV/0!" => Ok(CellErrorType::Div0), @@ -75,6 +78,7 @@ from_err!(zip::result::ZipError, XlsxError, Zip); from_err!(std::string::FromUtf8Error, XlsxError, Uft8); impl fmt::Display for XlsxError { + #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { use self::XlsxError::*; match self { diff --git a/src/structs/fill.rs b/src/structs/fill.rs index 18329fb9..21e0dd07 100644 --- a/src/structs/fill.rs +++ b/src/structs/fill.rs @@ -16,10 +16,12 @@ pub struct Fill { } impl Fill { + #[inline] pub fn get_pattern_fill(&self) -> Option<&PatternFill> { self.pattern_fill.as_deref() } + #[inline] pub fn get_pattern_fill_mut(&mut self) -> &mut PatternFill { if self.pattern_fill.is_some() { return self.pattern_fill.as_mut().unwrap(); @@ -28,16 +30,19 @@ impl Fill { self.pattern_fill.as_mut().unwrap() } + #[inline] pub fn set_pattern_fill(&mut self, value: PatternFill) -> &mut Self { self.pattern_fill = Some(Box::new(value)); self.gradient_fill = None; self } + #[inline] pub fn get_gradient_fill(&self) -> Option<&GradientFill> { self.gradient_fill.as_deref() } + #[inline] pub fn get_gradient_fill_mut(&mut self) -> &mut GradientFill { if self.gradient_fill.is_some() { return self.gradient_fill.as_mut().unwrap(); @@ -46,12 +51,14 @@ impl Fill { self.gradient_fill.as_mut().unwrap() } + #[inline] pub fn set_gradient_fill(&mut self, value: GradientFill) -> &mut Self { self.pattern_fill = None; self.gradient_fill = Some(Box::new(value)); self } + #[inline] pub(crate) fn get_default_value() -> Self { let mut def = Self::default(); let mut pfill = PatternFill::default(); @@ -60,6 +67,7 @@ impl Fill { def } + #[inline] pub(crate) fn get_default_value_2() -> Self { let mut def = Self::default(); let mut pfill = PatternFill::default(); @@ -94,6 +102,7 @@ impl Fill { } // When opened in software such as Excel, it is visually blank. + #[inline] pub(crate) fn is_visually_empty(&self) -> bool { !(self .pattern_fill diff --git a/src/structs/fills.rs b/src/structs/fills.rs index 52526670..d72e59cc 100644 --- a/src/structs/fills.rs +++ b/src/structs/fills.rs @@ -15,14 +15,17 @@ pub(crate) struct Fills { } impl Fills { + #[inline] pub(crate) fn get_fill(&self) -> &[Fill] { &self.fill } + #[inline] pub(crate) fn get_fill_mut(&mut self) -> &mut ThinVec { &mut self.fill } + #[inline] pub(crate) fn set_fill(&mut self, value: Fill) -> &mut Self { self.fill.push(value); self diff --git a/src/structs/font.rs b/src/structs/font.rs index cabf7727..a6691717 100644 --- a/src/structs/font.rs +++ b/src/structs/font.rs @@ -64,140 +64,171 @@ impl Font { pub const UNDERLINE_SINGLE: &'static str = "single"; pub const UNDERLINE_SINGLEACCOUNTING: &'static str = "singleAccounting"; + #[inline] pub fn get_font_name(&self) -> &FontName { &self.font_name } + #[inline] pub fn get_font_name_mut(&mut self) -> &mut FontName { &mut self.font_name } + #[inline] pub fn set_font_name(&mut self, value: FontName) -> &mut Self { self.font_name = value; self } + #[inline] pub fn get_name(&self) -> &str { self.font_name.get_val() } + #[inline] pub fn set_name>(&mut self, value: S) -> &mut Self { self.font_name.set_val(value); self.set_scheme("none"); self } + #[inline] pub fn set_name_with_scheme>(&mut self, name: S, scheme: S) -> &mut Self { self.set_name(name); self.set_scheme(scheme); self } + #[inline] pub fn get_font_size(&self) -> &FontSize { &self.font_size } + #[inline] pub fn get_font_size_mut(&mut self) -> &mut FontSize { &mut self.font_size } + #[inline] pub fn set_font_size(&mut self, value: FontSize) -> &mut Self { self.font_size = value; self } + #[inline] pub fn get_size(&self) -> &f64 { self.font_size.get_val() } + #[inline] pub fn set_size(&mut self, value: f64) -> &mut Self { self.font_size.set_val(value); self } + #[inline] pub fn get_font_family_numbering(&self) -> &FontFamilyNumbering { &self.font_family_numbering } + #[inline] pub fn get_font_family_numbering_mut(&mut self) -> &mut FontFamilyNumbering { &mut self.font_family_numbering } + #[inline] pub fn set_font_family_numbering(&mut self, value: FontFamilyNumbering) -> &mut Self { self.font_family_numbering = value; self } + #[inline] pub fn get_family(&self) -> &i32 { self.font_family_numbering.get_val() } + #[inline] pub fn set_family(&mut self, value: i32) -> &mut Self { self.font_family_numbering.set_val(value); self } + #[inline] pub fn get_font_bold(&self) -> &Bold { &self.font_bold } + #[inline] pub fn get_font_bold_mut(&mut self) -> &mut Bold { &mut self.font_bold } + #[inline] pub fn set_font_bold(&mut self, value: Bold) -> &mut Self { self.font_bold = value; self } + #[inline] pub fn get_bold(&self) -> &bool { self.font_bold.get_val() } + #[inline] pub fn set_bold(&mut self, value: bool) -> &mut Self { self.font_bold.set_val(value); self } + #[inline] pub fn get_font_italic(&self) -> &Italic { &self.font_italic } + #[inline] pub fn get_font_italic_mut(&mut self) -> &mut Italic { &mut self.font_italic } + #[inline] pub fn set_font_italic(&mut self, value: Italic) -> &mut Self { self.font_italic = value; self } + #[inline] pub fn get_italic(&self) -> &bool { self.font_italic.get_val() } + #[inline] pub fn set_italic(&mut self, value: bool) -> &mut Self { self.font_italic.set_val(value); self } + #[inline] pub fn get_font_underline(&self) -> &Underline { &self.font_underline } + #[inline] pub fn get_font_underline_mut(&mut self) -> &mut Underline { &mut self.font_underline } + #[inline] pub fn set_font_underline(&mut self, value: Underline) -> &mut Self { self.font_underline = value; self } + #[inline] pub fn get_underline(&self) -> &str { self.font_underline.val.get_value_string() } + #[inline] pub fn set_underline>(&mut self, value: S) -> &mut Self { let obj = value.into(); self.font_underline @@ -205,80 +236,98 @@ impl Font { self } + #[inline] pub fn get_font_strike(&self) -> &Strike { &self.font_strike } + #[inline] pub fn get_font_strike_mut(&mut self) -> &mut Strike { &mut self.font_strike } + #[inline] pub fn set_font_strike(&mut self, value: Strike) -> &mut Self { self.font_strike = value; self } + #[inline] pub fn get_strikethrough(&self) -> &bool { self.font_strike.get_val() } + #[inline] pub fn set_strikethrough(&mut self, value: bool) -> &mut Self { self.font_strike.set_val(value); self } + #[inline] pub fn get_color(&self) -> &Color { &self.color } + #[inline] pub fn get_color_mut(&mut self) -> &mut Color { &mut self.color } + #[inline] pub fn set_color(&mut self, value: Color) -> &mut Self { self.color = value; self } + #[inline] pub fn get_font_char_set(&self) -> &FontCharSet { &self.font_char_set } + #[inline] pub fn get_font_char_set_mut(&mut self) -> &mut FontCharSet { &mut self.font_char_set } + #[inline] pub fn set_font_char_set(&mut self, value: FontCharSet) -> &mut Self { self.font_char_set = value; self } + #[inline] pub fn get_charset(&self) -> &i32 { self.font_char_set.get_val() } + #[inline] pub fn set_charset(&mut self, value: i32) -> &mut Self { self.font_char_set.set_val(value); self } + #[inline] pub fn get_font_scheme(&self) -> &FontScheme { &self.font_scheme } + #[inline] pub fn get_font_scheme_mut(&mut self) -> &mut FontScheme { &mut self.font_scheme } + #[inline] pub fn set_font_scheme(&mut self, value: FontScheme) -> &mut Self { self.font_scheme = value; self } + #[inline] pub fn get_scheme(&self) -> &str { self.font_scheme.val.get_value_string() } + #[inline] pub fn set_scheme>(&mut self, value: S) -> &mut Self { let obj = value.into(); self.font_scheme @@ -286,19 +335,23 @@ impl Font { self } + #[inline] pub fn get_vertical_text_alignment(&self) -> &VerticalTextAlignment { &self.vertical_text_alignment } + #[inline] pub fn get_vertical_text_alignment_mut(&mut self) -> &mut VerticalTextAlignment { &mut self.vertical_text_alignment } + #[inline] pub fn set_vertical_text_alignment(&mut self, value: VerticalTextAlignment) -> &mut Self { self.vertical_text_alignment = value; self } + #[inline] pub(crate) fn get_default_value() -> Self { let mut def = Self::default(); def.set_size(11.0); @@ -388,11 +441,13 @@ impl Font { } } + #[inline] pub(crate) fn write_to_font(&self, writer: &mut Writer>>) { // font self.write_to(writer, "font", "name"); } + #[inline] pub(crate) fn write_to_rpr(&self, writer: &mut Writer>>) { // rPr self.write_to(writer, "rPr", "rFont"); diff --git a/src/structs/font_char_set.rs b/src/structs/font_char_set.rs index 0fef9879..c1dd13e7 100644 --- a/src/structs/font_char_set.rs +++ b/src/structs/font_char_set.rs @@ -13,15 +13,18 @@ pub struct FontCharSet { } impl FontCharSet { + #[inline] pub fn get_val(&self) -> &i32 { self.val.get_value() } + #[inline] pub fn set_val(&mut self, value: i32) -> &mut Self { self.val.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -30,6 +33,7 @@ impl FontCharSet { set_string_from_xml!(self, e, val, "val"); } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { // charset if self.val.has_value() { diff --git a/src/structs/font_family_numbering.rs b/src/structs/font_family_numbering.rs index d6bf8460..13b764fa 100644 --- a/src/structs/font_family_numbering.rs +++ b/src/structs/font_family_numbering.rs @@ -13,15 +13,18 @@ pub struct FontFamilyNumbering { } impl FontFamilyNumbering { + #[inline] pub fn get_val(&self) -> &i32 { self.val.get_value() } + #[inline] pub fn set_val(&mut self, value: i32) -> &mut Self { self.val.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -30,6 +33,7 @@ impl FontFamilyNumbering { set_string_from_xml!(self, e, val, "val"); } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { // family if self.val.has_value() { diff --git a/src/structs/font_name.rs b/src/structs/font_name.rs index 88f9ca12..5443c703 100644 --- a/src/structs/font_name.rs +++ b/src/structs/font_name.rs @@ -13,15 +13,18 @@ pub struct FontName { } impl FontName { + #[inline] pub fn get_val(&self) -> &str { self.val.get_value_str() } + #[inline] pub fn set_val>(&mut self, value: S) -> &mut Self { self.val.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -30,6 +33,7 @@ impl FontName { self.val.set_value_string(get_attribute(e, b"val").unwrap()); } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>, tag_name: &str) { // name, rFont if self.val.has_value() { diff --git a/src/structs/font_scheme.rs b/src/structs/font_scheme.rs index 3c79a5c6..f276af3b 100644 --- a/src/structs/font_scheme.rs +++ b/src/structs/font_scheme.rs @@ -14,15 +14,18 @@ pub struct FontScheme { } impl FontScheme { + #[inline] pub fn get_val(&self) -> &FontSchemeValues { self.val.get_value() } + #[inline] pub fn set_val(&mut self, value: FontSchemeValues) -> &mut Self { self.val.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -31,6 +34,7 @@ impl FontScheme { self.val.set_value_string(get_attribute(e, b"val").unwrap()); } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { // scheme if self.val.has_value() { diff --git a/src/structs/font_scheme_values.rs b/src/structs/font_scheme_values.rs index 99391044..c752759f 100644 --- a/src/structs/font_scheme_values.rs +++ b/src/structs/font_scheme_values.rs @@ -9,12 +9,14 @@ pub enum FontSchemeValues { } impl Default for FontSchemeValues { + #[inline] fn default() -> Self { Self::None } } impl EnumTrait for FontSchemeValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::Major => "major", @@ -26,6 +28,8 @@ impl EnumTrait for FontSchemeValues { impl FromStr for FontSchemeValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "major" => Ok(Self::Major), diff --git a/src/structs/font_size.rs b/src/structs/font_size.rs index 434e669c..ff3b418b 100644 --- a/src/structs/font_size.rs +++ b/src/structs/font_size.rs @@ -13,15 +13,18 @@ pub struct FontSize { } impl FontSize { + #[inline] pub fn get_val(&self) -> &f64 { self.val.get_value() } + #[inline] pub fn set_val(&mut self, value: f64) -> &mut Self { self.val.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -30,6 +33,7 @@ impl FontSize { self.val.set_value_string(get_attribute(e, b"val").unwrap()); } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { // sz if self.val.has_value() { diff --git a/src/structs/fonts.rs b/src/structs/fonts.rs index 2471ce58..22055e58 100644 --- a/src/structs/fonts.rs +++ b/src/structs/fonts.rs @@ -15,14 +15,17 @@ pub(crate) struct Fonts { } impl Fonts { + #[inline] pub(crate) fn get_font(&self) -> &[Font] { &self.font } + #[inline] pub(crate) fn get_font_mut(&mut self) -> &mut ThinVec { &mut self.font } + #[inline] pub(crate) fn set_font(&mut self, value: Font) -> &mut Self { self.font.push(value); self diff --git a/src/structs/formula.rs b/src/structs/formula.rs index ab88b2a0..985384e3 100644 --- a/src/structs/formula.rs +++ b/src/structs/formula.rs @@ -16,14 +16,17 @@ pub struct Formula { } impl Formula { + #[inline] pub fn get_address(&self) -> &Address { &self.address } + #[inline] pub fn get_address_mut(&mut self) -> &mut Address { &mut self.address } + #[inline] pub fn get_address_str(&self) -> String { if self.string_value.has_value() { return self.string_value.get_value_str().to_string(); @@ -31,18 +34,21 @@ impl Formula { self.address.get_address() } + #[inline] pub fn set_address(&mut self, value: Address) -> &mut Self { self.address = value; self.string_value.remove_value(); self } + #[inline] pub fn set_string_value>(&mut self, value: S) -> &mut Self { self.address = Address::default(); self.string_value.set_value(value); self } + #[inline] pub fn set_address_str>(&mut self, value: S) -> &mut Self { let value = value.into(); if is_address(&value) { @@ -72,6 +78,7 @@ impl Formula { ); } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { // formula write_start_tag(writer, "formula", vec![], false); diff --git a/src/structs/from_marker.rs b/src/structs/from_marker.rs index c108534b..957f841d 100644 --- a/src/structs/from_marker.rs +++ b/src/structs/from_marker.rs @@ -15,50 +15,61 @@ pub struct FromMarker { } impl FromMarker { + #[inline] pub fn get_col(&self) -> &usize { &self.col } + #[inline] pub fn set_col(&mut self, value: usize) -> &mut FromMarker { self.col = value; self } + #[inline] pub fn get_col_off(&self) -> &usize { &self.col_off } + #[inline] pub fn set_col_off(&mut self, value: usize) -> &mut FromMarker { self.col_off = value; self } + #[inline] pub fn get_row(&self) -> &usize { &self.row } + #[inline] pub fn set_row(&mut self, value: usize) -> &mut FromMarker { self.row = value; self } + #[inline] pub fn get_row_off(&self) -> &usize { &self.row_off } + #[inline] pub fn set_row_off(&mut self, value: usize) -> &mut FromMarker { self.row_off = value; self } + #[inline] pub(crate) fn _adjustment_insert_row(&mut self, num_rows: &usize) { self.row += num_rows; } + #[inline] pub(crate) fn _adjustment_insert_column(&mut self, num_cols: &usize) { self.col += num_cols; } + #[inline] pub(crate) fn _adjustment_remove_row(&mut self, num_rows: &usize) { self.row = if &self.row > num_rows { self.row - num_rows @@ -67,6 +78,7 @@ impl FromMarker { }; } + #[inline] pub(crate) fn _adjustment_remove_column(&mut self, num_cols: &usize) { self.col = if &self.col > num_cols { self.col - num_cols diff --git a/src/structs/gradient_fill.rs b/src/structs/gradient_fill.rs index ad2df548..a0646364 100644 --- a/src/structs/gradient_fill.rs +++ b/src/structs/gradient_fill.rs @@ -18,23 +18,28 @@ pub struct GradientFill { } impl GradientFill { + #[inline] pub fn get_degree(&self) -> &f64 { self.degree.get_value() } + #[inline] pub fn set_degree(&mut self, value: f64) -> &mut Self { self.degree.set_value(value); self } + #[inline] pub fn get_gradient_stop(&self) -> &[GradientStop] { &self.gradient_stop } + #[inline] pub fn get_gradient_stop_mut(&mut self) -> &mut ThinVec { &mut self.gradient_stop } + #[inline] pub fn set_gradient_stop(&mut self, value: GradientStop) -> &mut Self { self.gradient_stop.push(value); self diff --git a/src/structs/gradient_stop.rs b/src/structs/gradient_stop.rs index 5761dce2..f8bd220b 100644 --- a/src/structs/gradient_stop.rs +++ b/src/structs/gradient_stop.rs @@ -16,28 +16,34 @@ pub struct GradientStop { } impl GradientStop { + #[inline] pub fn get_position(&self) -> &f64 { self.position.get_value() } + #[inline] pub fn set_position(&mut self, value: f64) -> &mut Self { self.position.set_value(value); self } + #[inline] pub fn get_color(&self) -> &Color { &self.color } + #[inline] pub fn get_color_mut(&mut self) -> &mut Color { &mut self.color } + #[inline] pub fn set_color(&mut self, value: Color) -> &mut Self { self.color = value; self } + #[inline] pub(crate) fn get_hash_code(&self) -> String { format!( "{:x}", diff --git a/src/structs/header_footer.rs b/src/structs/header_footer.rs index c23ea57c..6d5ef1ac 100644 --- a/src/structs/header_footer.rs +++ b/src/structs/header_footer.rs @@ -15,32 +15,39 @@ pub struct HeaderFooter { } impl HeaderFooter { + #[inline] pub fn get_odd_header(&self) -> &OddHeader { &self.odd_header } + #[inline] pub fn get_odd_header_mut(&mut self) -> &mut OddHeader { &mut self.odd_header } + #[inline] pub fn set_odd_header(&mut self, value: OddHeader) -> &mut Self { self.odd_header = value; self } + #[inline] pub fn get_odd_footer(&self) -> &OddFooter { &self.odd_footer } + #[inline] pub fn get_odd_footer_mut(&mut self) -> &mut OddFooter { &mut self.odd_footer } + #[inline] pub fn set_odd_footer(&mut self, value: OddFooter) -> &mut Self { self.odd_footer = value; self } + #[inline] pub(crate) fn has_param(&self) -> bool { self.odd_header.has_param() || self.odd_footer.has_param() } diff --git a/src/structs/horizontal_alignment_values.rs b/src/structs/horizontal_alignment_values.rs index fe5ebec0..da025268 100644 --- a/src/structs/horizontal_alignment_values.rs +++ b/src/structs/horizontal_alignment_values.rs @@ -12,11 +12,13 @@ pub enum HorizontalAlignmentValues { Right, } impl Default for HorizontalAlignmentValues { + #[inline] fn default() -> Self { Self::General } } impl EnumTrait for HorizontalAlignmentValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::Center => "center", @@ -32,6 +34,8 @@ impl EnumTrait for HorizontalAlignmentValues { } impl FromStr for HorizontalAlignmentValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "center" => Ok(Self::Center), diff --git a/src/structs/hyperlink.rs b/src/structs/hyperlink.rs index 3e484e90..d537b56c 100644 --- a/src/structs/hyperlink.rs +++ b/src/structs/hyperlink.rs @@ -5,28 +5,34 @@ pub struct Hyperlink { location: bool, } impl Hyperlink { + #[inline] pub fn get_url(&self) -> &str { &self.url } + #[inline] pub fn set_url>(&mut self, value: S) -> &mut Hyperlink { self.url = value.into().into_boxed_str(); self } + #[inline] pub fn get_tooltip(&self) -> &str { &self.tooltip } + #[inline] pub fn set_tooltip>(&mut self, value: S) -> &mut Hyperlink { self.tooltip = value.into().into_boxed_str(); self } + #[inline] pub fn get_location(&self) -> &bool { &self.location } + #[inline] pub fn set_location(&mut self, value: bool) -> &mut Hyperlink { self.location = value; self diff --git a/src/structs/icon_set.rs b/src/structs/icon_set.rs index 57cc12e6..3170b228 100644 --- a/src/structs/icon_set.rs +++ b/src/structs/icon_set.rs @@ -16,10 +16,12 @@ pub struct IconSet { } impl IconSet { + #[inline] pub fn get_cfvo_collection(&self) -> &[ConditionalFormatValueObject] { &self.cfvo_collection } + #[inline] pub fn set_cfvo_collection( &mut self, value: impl Into>, @@ -28,20 +30,24 @@ impl IconSet { self } + #[inline] pub fn add_cfvo_collection(&mut self, value: ConditionalFormatValueObject) -> &mut Self { self.cfvo_collection.push(value); self } + #[inline] pub fn get_color_collection(&self) -> &[Color] { &self.color_collection } + #[inline] pub fn set_color_collection(&mut self, value: impl Into>) -> &mut Self { self.color_collection = value.into(); self } + #[inline] pub fn add_color_collection(&mut self, value: Color) -> &mut Self { self.color_collection.push(value); self diff --git a/src/structs/image.rs b/src/structs/image.rs index 2e73b5f5..19c18ebe 100644 --- a/src/structs/image.rs +++ b/src/structs/image.rs @@ -65,37 +65,45 @@ pub struct Image { /// .change_image("./images/sample1.png"); /// ``` impl Image { + #[inline] pub fn get_two_cell_anchor(&self) -> Option<&TwoCellAnchor> { self.two_cell_anchor.as_deref() } + #[inline] pub fn get_two_cell_anchor_mut(&mut self) -> Option<&mut TwoCellAnchor> { self.two_cell_anchor.as_deref_mut() } + #[inline] pub fn set_two_cell_anchor(&mut self, value: TwoCellAnchor) -> &mut Self { self.two_cell_anchor = Some(Box::new(value)); self } + #[inline] pub fn remove_two_cell_anchor(&mut self) -> &mut Self { self.two_cell_anchor = None; self } + #[inline] pub fn get_one_cell_anchor(&self) -> Option<&OneCellAnchor> { self.one_cell_anchor.as_deref() } + #[inline] pub fn get_one_cell_anchor_mut(&mut self) -> Option<&mut OneCellAnchor> { self.one_cell_anchor.as_deref_mut() } + #[inline] pub fn set_one_cell_anchor(&mut self, value: OneCellAnchor) -> &mut Self { self.one_cell_anchor = Some(Box::new(value)); self } + #[inline] pub fn remove_one_cell_anchor(&mut self) -> &mut Self { self.one_cell_anchor = None; self @@ -168,6 +176,7 @@ impl Image { } #[cfg(feature = "image")] + #[inline] pub fn change_image(&mut self, path: &str) { let marker = self.get_from_marker_type().clone(); self.remove_two_cell_anchor(); @@ -175,14 +184,17 @@ impl Image { self.new_image(path, marker); } + #[inline] pub fn download_image(&self, path: &str) { fs::write(path, self.get_image_data()).unwrap(); } + #[inline] pub fn has_image(&self) -> bool { !self.get_media_object().is_empty() } + #[inline] pub fn get_image_name(&self) -> &str { match self.get_media_object().first() { Some(v) => v.get_image_name(), @@ -190,6 +202,7 @@ impl Image { } } + #[inline] pub fn get_image_data(&self) -> &[u8] { match self.get_media_object().first() { Some(v) => v.get_image_data(), @@ -197,22 +210,27 @@ impl Image { } } + #[inline] pub fn get_image_data_base64(&self) -> String { STANDARD.encode(self.get_image_data()) } + #[inline] pub fn get_coordinate(&self) -> String { self.get_from_marker_type().get_coordinate() } + #[inline] pub fn get_col(&self) -> &u32 { self.get_from_marker_type().get_col() } + #[inline] pub fn get_row(&self) -> &u32 { self.get_from_marker_type().get_row() } + #[inline] pub fn get_from_marker_type(&self) -> &MarkerType { if let Some(anchor) = self.get_two_cell_anchor() { return anchor.get_from_marker(); @@ -223,6 +241,7 @@ impl Image { panic!("Not Found MediaObject"); } + #[inline] pub fn get_to_marker_type(&self) -> Option<&MarkerType> { self.get_two_cell_anchor() .as_ref() @@ -279,6 +298,7 @@ impl Image { result } + #[inline] pub(crate) fn write_to( &self, writer: &mut Writer>>, @@ -293,6 +313,7 @@ impl Image { } } impl AdjustmentCoordinate for Image { + #[inline] fn adjustment_insert_coordinate( &mut self, root_col_num: &u32, @@ -327,6 +348,7 @@ impl AdjustmentCoordinate for Image { } } + #[inline] fn adjustment_remove_coordinate( &mut self, root_col_num: &u32, @@ -361,6 +383,7 @@ impl AdjustmentCoordinate for Image { } } + #[inline] fn is_remove_coordinate( &self, root_col_num: &u32, diff --git a/src/structs/int16_value.rs b/src/structs/int16_value.rs index 65fb4dca..cddf7ce7 100644 --- a/src/structs/int16_value.rs +++ b/src/structs/int16_value.rs @@ -4,6 +4,7 @@ pub struct Int16Value { value: Option, } impl Int16Value { + #[inline] pub(crate) fn _get_value(&self) -> &i16 { match &self.value { Some(v) => v, @@ -11,23 +12,28 @@ impl Int16Value { } } + #[inline] pub(crate) fn _get_value_string(&self) -> String { self._get_value().to_string() } + #[inline] pub(crate) fn _set_value(&mut self, value: i16) -> &mut Int16Value { self.value = Some(value); self } + #[inline] pub(crate) fn _set_value_string>(&mut self, value: S) -> &mut Int16Value { self._set_value(value.into().parse::().unwrap()) } + #[inline] pub(crate) fn _has_value(&self) -> bool { self.value.is_some() } + #[inline] pub(crate) fn _get_hash_string(&self) -> String { if self._has_value() { return self._get_value_string(); diff --git a/src/structs/int32_value.rs b/src/structs/int32_value.rs index 372b4ac7..cb8af4d7 100644 --- a/src/structs/int32_value.rs +++ b/src/structs/int32_value.rs @@ -3,6 +3,7 @@ pub struct Int32Value { value: Option, } impl Int32Value { + #[inline] pub(crate) fn get_value(&self) -> &i32 { match &self.value { Some(v) => v, @@ -10,23 +11,28 @@ impl Int32Value { } } + #[inline] pub(crate) fn get_value_string(&self) -> String { self.get_value().to_string() } + #[inline] pub(crate) fn set_value(&mut self, value: i32) -> &mut Self { self.value = Some(value); self } + #[inline] pub(crate) fn set_value_string>(&mut self, value: S) -> &mut Self { self.set_value(value.into().parse::().unwrap()) } + #[inline] pub(crate) fn has_value(&self) -> bool { self.value.is_some() } + #[inline] pub(crate) fn get_hash_string(&self) -> String { if self.has_value() { return self.get_value_string(); diff --git a/src/structs/int64_value.rs b/src/structs/int64_value.rs index 9f81d49d..7124d2c7 100644 --- a/src/structs/int64_value.rs +++ b/src/structs/int64_value.rs @@ -3,6 +3,7 @@ pub struct Int64Value { value: Option, } impl Int64Value { + #[inline] pub(crate) fn get_value(&self) -> &i64 { match &self.value { Some(v) => v, @@ -10,23 +11,28 @@ impl Int64Value { } } + #[inline] pub(crate) fn get_value_string(&self) -> String { self.get_value().to_string() } + #[inline] pub(crate) fn set_value(&mut self, value: i64) -> &mut Int64Value { self.value = Some(value); self } + #[inline] pub(crate) fn set_value_string>(&mut self, value: S) -> &mut Int64Value { self.set_value(value.into().parse::().unwrap()) } + #[inline] pub(crate) fn has_value(&self) -> bool { self.value.is_some() } + #[inline] pub(crate) fn _get_hash_string(&self) -> String { if self.has_value() { return self.get_value_string(); diff --git a/src/structs/italic.rs b/src/structs/italic.rs index 9f2be277..85f178f1 100644 --- a/src/structs/italic.rs +++ b/src/structs/italic.rs @@ -13,15 +13,18 @@ pub struct Italic { } impl Italic { + #[inline] pub fn get_val(&self) -> &bool { self.val.get_value() } + #[inline] pub fn set_val(&mut self, value: bool) -> &mut Self { self.val.set_value(value); self } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, @@ -31,6 +34,7 @@ impl Italic { set_string_from_xml!(self, e, val, "val"); } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { // i if *self.val.get_value() { diff --git a/src/structs/media_object.rs b/src/structs/media_object.rs index 4b87e64e..1d48d53b 100644 --- a/src/structs/media_object.rs +++ b/src/structs/media_object.rs @@ -6,19 +6,23 @@ pub struct MediaObject { image_data: ThinVec, } impl MediaObject { + #[inline] pub fn get_image_name(&self) -> &str { &self.image_name } + #[inline] pub fn set_image_name>(&mut self, value: S) -> &mut Self { self.image_name = value.into().into_boxed_str(); self } + #[inline] pub fn get_image_data(&self) -> &[u8] { &self.image_data } + #[inline] pub fn set_image_data(&mut self, value: impl Into>) -> &mut Self { self.image_data = value.into(); self diff --git a/src/structs/merge_cells.rs b/src/structs/merge_cells.rs index b1683e15..6930cd07 100644 --- a/src/structs/merge_cells.rs +++ b/src/structs/merge_cells.rs @@ -15,14 +15,17 @@ pub(crate) struct MergeCells { } impl MergeCells { + #[inline] pub(crate) fn get_range_collection(&self) -> &[Range] { &self.range } + #[inline] pub(crate) fn get_range_collection_mut(&mut self) -> &mut ThinVec { &mut self.range } + #[inline] pub(crate) fn add_range>(&mut self, range: S) -> &mut Self { let mut obj = Range::default(); obj.set_range(range); diff --git a/src/structs/mru_colors.rs b/src/structs/mru_colors.rs index 6a1e9638..54f26a82 100644 --- a/src/structs/mru_colors.rs +++ b/src/structs/mru_colors.rs @@ -14,14 +14,17 @@ pub(crate) struct MruColors { } impl MruColors { + #[inline] pub(crate) fn get_color(&self) -> &[Color] { &self.color } + #[inline] pub(crate) fn _get_color_mut(&mut self) -> &mut ThinVec { &mut self.color } + #[inline] pub(crate) fn set_color(&mut self, value: Color) -> &mut Self { self.color.push(value); self diff --git a/src/structs/numbering_format.rs b/src/structs/numbering_format.rs index 579f1a3e..1f690fdb 100644 --- a/src/structs/numbering_format.rs +++ b/src/structs/numbering_format.rs @@ -16,6 +16,7 @@ pub struct NumberingFormat { } impl Default for NumberingFormat { + #[inline] fn default() -> Self { Self { number_format_id: 0, @@ -71,6 +72,7 @@ impl NumberingFormat { pub const FORMAT_ACCOUNTING_EUR: &'static str = r#"_("€"* #,##0.00_);_("€"* \(#,##0.00\);_("€"* "-"??_);_(@_)"#; + #[inline] pub fn get_number_format_id(&self) -> &u32 { &self.number_format_id } @@ -92,6 +94,7 @@ impl NumberingFormat { self } + #[inline] pub(crate) fn set_number_format_id_crate(&mut self, value: u32) -> &mut Self { self.number_format_id = value; self @@ -122,19 +125,23 @@ impl NumberingFormat { self } + #[inline] pub(crate) fn set_format_code_crate>(&mut self, value: S) -> &mut Self { self.format_code = value.into().into_boxed_str(); self } + #[inline] pub fn get_format_code(&self) -> &str { &self.format_code } + #[inline] pub(crate) fn get_is_build_in(&self) -> &bool { &self.is_build_in } + #[inline] pub(crate) fn get_hash_code(&self) -> String { format!("{:x}", md5::Md5::digest(&*self.format_code)) } diff --git a/src/structs/numbering_formats.rs b/src/structs/numbering_formats.rs index e0c218d5..7e2971f5 100644 --- a/src/structs/numbering_formats.rs +++ b/src/structs/numbering_formats.rs @@ -15,20 +15,24 @@ pub(crate) struct NumberingFormats { } impl NumberingFormats { + #[inline] pub(crate) fn get_numbering_format(&self) -> &HashMap { &self.numbering_format } + #[inline] pub(crate) fn _get_numbering_format_mut(&mut self) -> &mut HashMap { &mut self.numbering_format } + #[inline] pub(crate) fn set_numbering_format(&mut self, value: NumberingFormat) -> &mut Self { let number_format_id = value.get_number_format_id(); self.numbering_format.insert(*number_format_id, value); self } + #[inline] pub(crate) fn _init_setup(&mut self) -> &mut Self { self.get_build_in_formats(); self diff --git a/src/structs/object_anchor.rs b/src/structs/object_anchor.rs index a6385fdd..39fc65b1 100644 --- a/src/structs/object_anchor.rs +++ b/src/structs/object_anchor.rs @@ -16,56 +16,68 @@ pub struct ObjectAnchor { } impl ObjectAnchor { + #[inline] pub fn get_move_with_cells(&self) -> &bool { self.move_with_cells.get_value() } + #[inline] pub fn set_move_with_cells(&mut self, value: bool) -> &mut Self { self.move_with_cells.set_value(value); self } + #[inline] pub fn get_from_marker(&self) -> &FromMarker { &self.from_marker } + #[inline] pub fn get_from_marker_mut(&mut self) -> &mut FromMarker { &mut self.from_marker } + #[inline] pub fn set_from_marker(&mut self, value: FromMarker) -> &mut Self { self.from_marker = value; self } + #[inline] pub fn get_to_marker(&self) -> &ToMarker { &self.to_marker } + #[inline] pub fn get_to_marker_mut(&mut self) -> &mut ToMarker { &mut self.to_marker } + #[inline] pub fn set_to_marker(&mut self, value: ToMarker) -> &mut Self { self.to_marker = value; self } + #[inline] pub(crate) fn _adjustment_insert_row(&mut self, num_rows: &usize) { self.from_marker._adjustment_insert_row(num_rows); self.to_marker._adjustment_insert_row(num_rows); } + #[inline] pub(crate) fn _adjustment_insert_column(&mut self, num_cols: &usize) { self.from_marker._adjustment_insert_column(num_cols); self.to_marker._adjustment_insert_column(num_cols); } + #[inline] pub(crate) fn _adjustment_remove_row(&mut self, num_rows: &usize) { self.from_marker._adjustment_remove_row(num_rows); self.to_marker._adjustment_remove_row(num_rows); } + #[inline] pub(crate) fn _adjustment_remove_column(&mut self, num_cols: &usize) { self.from_marker._adjustment_remove_column(num_cols); self.to_marker._adjustment_remove_column(num_cols); diff --git a/src/structs/odd_footer.rs b/src/structs/odd_footer.rs index dc53913d..7c98e677 100644 --- a/src/structs/odd_footer.rs +++ b/src/structs/odd_footer.rs @@ -14,19 +14,23 @@ pub struct OddFooter { } impl OddFooter { + #[inline] pub fn get_value(&self) -> &str { self.value.get_value_str() } + #[inline] pub fn set_value>(&mut self, value: S) -> &mut Self { self.value.set_value(value); self } + #[inline] pub(crate) fn _get_hash_code(&self) -> String { format!("{:x}", md5::Md5::digest(self.get_value())) } + #[inline] pub(crate) fn has_param(&self) -> bool { self.value.has_value() } @@ -50,6 +54,7 @@ impl OddFooter { ); } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { if self.has_param() { // oddFooter diff --git a/src/structs/odd_header.rs b/src/structs/odd_header.rs index e450bc56..81d4e2ed 100644 --- a/src/structs/odd_header.rs +++ b/src/structs/odd_header.rs @@ -14,19 +14,23 @@ pub struct OddHeader { } impl OddHeader { + #[inline] pub fn get_value(&self) -> &str { self.value.get_value_str() } + #[inline] pub fn set_value>(&mut self, value: S) -> &mut Self { self.value.set_value(value); self } + #[inline] pub(crate) fn _get_hash_code(&self) -> String { format!("{:x}", md5::Md5::digest(self.get_value())) } + #[inline] pub(crate) fn has_param(&self) -> bool { self.value.has_value() } @@ -50,6 +54,7 @@ impl OddHeader { ); } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { if self.has_param() { // oddHeader diff --git a/src/structs/office/excel/formula.rs b/src/structs/office/excel/formula.rs index 49931e67..e4f65602 100644 --- a/src/structs/office/excel/formula.rs +++ b/src/structs/office/excel/formula.rs @@ -13,14 +13,17 @@ pub struct Formula { value: Address, } impl Formula { + #[inline] pub fn get_value(&self) -> &Address { &self.value } + #[inline] pub fn get_value_mut(&mut self) -> &mut Address { &mut self.value } + #[inline] pub fn set_value(&mut self, value: Address) -> &mut Self { self.value = value; self @@ -56,6 +59,7 @@ impl Formula { } } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { write_start_tag(writer, "xm:f", vec![], false); write_text_node(writer, &self.value.get_address()); diff --git a/src/structs/office/excel/reference_sequence.rs b/src/structs/office/excel/reference_sequence.rs index 38987be5..1ae4665c 100644 --- a/src/structs/office/excel/reference_sequence.rs +++ b/src/structs/office/excel/reference_sequence.rs @@ -15,24 +15,29 @@ pub struct ReferenceSequence { value: ThinVec, } impl ReferenceSequence { + #[inline] pub fn get_value(&self) -> &[Range] { &self.value } + #[inline] pub fn get_value_mut(&mut self) -> &mut ThinVec { &mut self.value } + #[inline] pub fn set_value(&mut self, value: impl Into>) -> &mut Self { self.value = value.into(); self } + #[inline] pub fn add_value(&mut self, value: Range) -> &mut Self { self.value.push(value); self } + #[inline] pub fn remove_value(&mut self) -> &mut Self { self.value.clear(); self @@ -47,6 +52,7 @@ impl ReferenceSequence { self } + #[inline] pub fn get_sqref(&self) -> String { self.value .iter() @@ -83,6 +89,7 @@ impl ReferenceSequence { } } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { write_start_tag(writer, "xm:sqref", vec![], false); write_text_node(writer, &self.get_sqref()); diff --git a/src/structs/office2010/excel/data_validation.rs b/src/structs/office2010/excel/data_validation.rs index 43126657..d79cb68a 100644 --- a/src/structs/office2010/excel/data_validation.rs +++ b/src/structs/office2010/excel/data_validation.rs @@ -29,113 +29,138 @@ pub struct DataValidation { formula2: Option>, } impl DataValidation { + #[inline] pub fn get_type(&self) -> &DataValidationValues { self.r#type.get_value() } + #[inline] pub fn set_type(&mut self, value: DataValidationValues) -> &mut Self { self.r#type.set_value(value); self } + #[inline] pub fn get_operator(&self) -> &DataValidationOperatorValues { self.operator.get_value() } + #[inline] pub fn set_operator(&mut self, value: DataValidationOperatorValues) -> &mut Self { self.operator.set_value(value); self } + #[inline] pub fn get_allow_blank(&self) -> &bool { self.allow_blank.get_value() } + #[inline] pub fn set_allow_blank(&mut self, value: bool) -> &mut Self { self.allow_blank.set_value(value); self } + #[inline] pub fn get_show_input_message(&self) -> &bool { self.show_input_message.get_value() } + #[inline] pub fn set_show_input_message(&mut self, value: bool) -> &mut Self { self.show_input_message.set_value(value); self } + #[inline] pub fn get_show_error_message(&self) -> &bool { self.show_error_message.get_value() } + #[inline] pub fn set_show_error_message(&mut self, value: bool) -> &mut Self { self.show_error_message.set_value(value); self } + #[inline] pub fn get_prompt_title(&self) -> &str { self.prompt_title.get_value_str() } + #[inline] pub fn set_prompt_title>(&mut self, value: S) -> &mut Self { self.prompt_title.set_value(value); self } + #[inline] pub fn get_prompt(&self) -> &str { self.prompt.get_value_str() } + #[inline] pub fn set_prompt>(&mut self, value: S) -> &mut Self { self.prompt.set_value(value); self } + #[inline] pub fn get_reference_sequence(&self) -> &ReferenceSequence { &self.reference_sequence } + #[inline] pub fn get_reference_sequence_mut(&mut self) -> &mut ReferenceSequence { &mut self.reference_sequence } + #[inline] pub fn set_reference_sequence(&mut self, value: ReferenceSequence) -> &mut Self { self.reference_sequence = value; self } + #[inline] pub fn get_formula1(&self) -> Option<&DataValidationForumla1> { self.formula1.as_deref() } + #[inline] pub fn get_formula1_mut(&mut self) -> Option<&mut DataValidationForumla1> { self.formula1.as_deref_mut() } + #[inline] pub fn set_formula1(&mut self, value: DataValidationForumla1) -> &mut Self { self.formula1 = Some(Box::new(value)); self } + #[inline] pub fn remove_formula1(&mut self) -> &mut Self { self.formula1 = None; self } + #[inline] pub fn get_formula2(&self) -> Option<&DataValidationForumla2> { self.formula2.as_deref() } + #[inline] pub fn get_formula2_mut(&mut self) -> Option<&mut DataValidationForumla2> { self.formula2.as_deref_mut() } + #[inline] pub fn set_formula2(&mut self, value: DataValidationForumla2) -> &mut Self { self.formula2 = Some(Box::new(value)); self } + #[inline] pub fn remove_formula2(&mut self) -> &mut Self { self.formula2 = None; self diff --git a/src/structs/office2010/excel/data_validation_forumla1.rs b/src/structs/office2010/excel/data_validation_forumla1.rs index 5d25f9bb..cf3a1f13 100644 --- a/src/structs/office2010/excel/data_validation_forumla1.rs +++ b/src/structs/office2010/excel/data_validation_forumla1.rs @@ -14,14 +14,17 @@ pub struct DataValidationForumla1 { value: Formula, } impl DataValidationForumla1 { + #[inline] pub fn get_value(&self) -> &Formula { &self.value } + #[inline] pub fn get_value_mut(&mut self) -> &mut Formula { &mut self.value } + #[inline] pub fn set_value(&mut self, value: Formula) -> &mut Self { self.value = value; self @@ -56,6 +59,7 @@ impl DataValidationForumla1 { } } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { write_start_tag(writer, "x14:formula1", vec![], false); &self.value.write_to(writer); diff --git a/src/structs/office2010/excel/data_validation_forumla2.rs b/src/structs/office2010/excel/data_validation_forumla2.rs index 443c174e..27c55509 100644 --- a/src/structs/office2010/excel/data_validation_forumla2.rs +++ b/src/structs/office2010/excel/data_validation_forumla2.rs @@ -14,14 +14,17 @@ pub struct DataValidationForumla2 { value: Formula, } impl DataValidationForumla2 { + #[inline] pub fn get_value(&self) -> &Formula { &self.value } + #[inline] pub fn get_value_mut(&mut self) -> &mut Formula { &mut self.value } + #[inline] pub fn set_value(&mut self, value: Formula) -> &mut Self { self.value = value; self @@ -56,6 +59,7 @@ impl DataValidationForumla2 { } } + #[inline] pub(crate) fn write_to(&self, writer: &mut Writer>>) { write_start_tag(writer, "x14:formula2", vec![], false); &self.value.write_to(writer); diff --git a/src/structs/office2010/excel/data_validations.rs b/src/structs/office2010/excel/data_validations.rs index 57d6c214..88d4c2ca 100644 --- a/src/structs/office2010/excel/data_validations.rs +++ b/src/structs/office2010/excel/data_validations.rs @@ -15,14 +15,17 @@ pub struct DataValidations { } impl DataValidations { + #[inline] pub fn get_data_validation_list(&self) -> &[DataValidation] { &self.data_validation_list } + #[inline] pub fn get_data_validation_list_mut(&mut self) -> &mut ThinVec { &mut self.data_validation_list } + #[inline] pub fn set_data_validation_list( &mut self, value: impl Into>, @@ -31,6 +34,7 @@ impl DataValidations { self } + #[inline] pub fn add_data_validation_list(&mut self, value: DataValidation) -> &mut Self { self.data_validation_list.push(value); self diff --git a/src/structs/ole_object.rs b/src/structs/ole_object.rs index 3f2212aa..dbe9dd93 100644 --- a/src/structs/ole_object.rs +++ b/src/structs/ole_object.rs @@ -24,88 +24,108 @@ pub struct OleObject { } impl OleObject { + #[inline] pub fn get_requires(&self) -> &str { self.requires.get_value_str() } + #[inline] pub fn set_requires>(&mut self, value: S) -> &mut Self { self.requires.set_value(value); self } + #[inline] pub fn get_prog_id(&self) -> &str { self.prog_id.get_value_str() } + #[inline] pub fn set_prog_id>(&mut self, value: S) -> &mut Self { self.prog_id.set_value(value); self } + #[inline] pub fn get_object_extension(&self) -> &str { &self.object_extension } + #[inline] pub fn set_object_extension>(&mut self, value: S) { self.object_extension = value.into().into_boxed_str(); } + #[inline] pub fn get_object_data(&self) -> Option<&[u8]> { self.object_data.as_deref() } + #[inline] pub fn get_object_data_mut(&mut self) -> Option<&mut ThinVec> { self.object_data.as_mut() } + #[inline] pub fn set_object_data(&mut self, value: impl Into>) -> &mut Self { self.object_data = Some(value.into()); self } + #[inline] pub fn get_embedded_object_properties(&self) -> &EmbeddedObjectProperties { &self.embedded_object_properties } + #[inline] pub fn get_embedded_object_properties_mut(&mut self) -> &mut EmbeddedObjectProperties { &mut self.embedded_object_properties } + #[inline] pub fn set_embedded_object_properties(&mut self, value: EmbeddedObjectProperties) -> &mut Self { self.embedded_object_properties = value; self } + #[inline] pub fn get_two_cell_anchor(&self) -> &TwoCellAnchor { &self.two_cell_anchor } + #[inline] pub fn get_two_cell_anchor_mut(&mut self) -> &mut TwoCellAnchor { &mut self.two_cell_anchor } + #[inline] pub fn set_two_cell_anchor(&mut self, value: TwoCellAnchor) -> &mut Self { self.two_cell_anchor = value; self } + #[inline] pub fn get_shape(&self) -> &Shape { &self.shape } + #[inline] pub fn get_shape_mut(&mut self) -> &mut Shape { &mut self.shape } + #[inline] pub fn set_shape(&mut self, value: Shape) -> &mut Self { self.shape = value; self } + #[inline] pub(crate) fn is_bin(&self) -> bool { &*self.object_extension == "bin" } + #[inline] pub(crate) fn is_xlsx(&self) -> bool { &*self.object_extension == "xlsx" } diff --git a/src/structs/ole_objects.rs b/src/structs/ole_objects.rs index 24f37e3c..51c0bf36 100644 --- a/src/structs/ole_objects.rs +++ b/src/structs/ole_objects.rs @@ -15,14 +15,17 @@ pub struct OleObjects { } impl OleObjects { + #[inline] pub fn get_ole_object(&self) -> &[OleObject] { &self.ole_object } + #[inline] pub fn get_ole_object_mut(&mut self) -> &mut ThinVec { &mut self.ole_object } + #[inline] pub fn set_ole_object(&mut self, value: OleObject) -> &mut Self { self.ole_object.push(value); self diff --git a/src/structs/orientation_values.rs b/src/structs/orientation_values.rs index 88508f7c..35a15419 100644 --- a/src/structs/orientation_values.rs +++ b/src/structs/orientation_values.rs @@ -7,11 +7,13 @@ pub enum OrientationValues { Portrait, } impl Default for OrientationValues { + #[inline] fn default() -> Self { Self::Default } } impl EnumTrait for OrientationValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::Default => "default", @@ -22,6 +24,8 @@ impl EnumTrait for OrientationValues { } impl FromStr for OrientationValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "default" => Ok(Self::Default), diff --git a/src/structs/page_margins.rs b/src/structs/page_margins.rs index 4c549767..f539ef57 100644 --- a/src/structs/page_margins.rs +++ b/src/structs/page_margins.rs @@ -17,55 +17,67 @@ pub struct PageMargins { footer: DoubleValue, } impl PageMargins { + #[inline] pub fn get_left(&self) -> &f64 { self.left.get_value() } + #[inline] pub fn set_left(&mut self, value: f64) -> &mut Self { self.left.set_value(value); self } + #[inline] pub fn get_right(&self) -> &f64 { self.right.get_value() } + #[inline] pub fn set_right(&mut self, value: f64) -> &mut Self { self.right.set_value(value); self } + #[inline] pub fn get_top(&self) -> &f64 { self.top.get_value() } + #[inline] pub fn set_top(&mut self, value: f64) -> &mut Self { self.top.set_value(value); self } + #[inline] pub fn get_bottom(&self) -> &f64 { self.bottom.get_value() } + #[inline] pub fn set_bottom(&mut self, value: f64) -> &mut Self { self.bottom.set_value(value); self } + #[inline] pub fn get_header(&self) -> &f64 { self.header.get_value() } + #[inline] pub fn set_header(&mut self, value: f64) -> &mut Self { self.header.set_value(value); self } + #[inline] pub fn get_footer(&self) -> &f64 { self.footer.get_value() } + #[inline] pub fn set_footer(&mut self, value: f64) -> &mut Self { self.footer.set_value(value); self diff --git a/src/structs/page_setup.rs b/src/structs/page_setup.rs index 5d6e0e85..4ef22b70 100644 --- a/src/structs/page_setup.rs +++ b/src/structs/page_setup.rs @@ -23,82 +23,100 @@ pub struct PageSetup { } impl PageSetup { + #[inline] pub fn get_paper_size(&self) -> &u32 { self.paper_size.get_value() } + #[inline] pub fn set_paper_size(&mut self, value: u32) -> &mut Self { self.paper_size.set_value(value); self } + #[inline] pub fn get_orientation(&self) -> &OrientationValues { self.orientation.get_value() } + #[inline] pub fn set_orientation(&mut self, value: OrientationValues) -> &mut Self { self.orientation.set_value(value); self } + #[inline] pub fn get_scale(&self) -> &u32 { self.scale.get_value() } + #[inline] pub fn set_scale(&mut self, value: u32) -> &mut Self { self.scale.set_value(value); self } + #[inline] pub fn get_fit_to_height(&self) -> &u32 { self.fit_to_height.get_value() } + #[inline] pub fn set_fit_to_height(&mut self, value: u32) -> &mut Self { self.fit_to_height.set_value(value); self } + #[inline] pub fn get_fit_to_width(&self) -> &u32 { self.fit_to_width.get_value() } + #[inline] pub fn set_fit_to_width(&mut self, value: u32) -> &mut Self { self.fit_to_width.set_value(value); self } + #[inline] pub fn get_horizontal_dpi(&self) -> &u32 { self.horizontal_dpi.get_value() } + #[inline] pub fn set_horizontal_dpi(&mut self, value: u32) -> &mut Self { self.horizontal_dpi.set_value(value); self } + #[inline] pub fn get_vertical_dpi(&self) -> &u32 { self.vertical_dpi.get_value() } + #[inline] pub fn set_vertical_dpi(&mut self, value: u32) -> &mut Self { self.vertical_dpi.set_value(value); self } + #[inline] pub fn get_object_data(&self) -> Option<&[u8]> { self.object_data.as_deref() } + #[inline] pub fn get_object_data_mut(&mut self) -> Option<&mut ThinVec> { self.object_data.as_mut() } + #[inline] pub fn set_object_data(&mut self, value: impl Into>) -> &mut Self { self.object_data = Some(value.into()); self } + #[inline] pub(crate) fn has_param(&self) -> bool { self.paper_size.has_value() || self.orientation.has_value() diff --git a/src/structs/pane.rs b/src/structs/pane.rs index 7ee917e9..cf12ae03 100644 --- a/src/structs/pane.rs +++ b/src/structs/pane.rs @@ -20,50 +20,61 @@ pub struct Pane { } impl Pane { + #[inline] pub fn get_horizontal_split(&self) -> &f64 { self.horizontal_split.get_value() } + #[inline] pub fn set_horizontal_split(&mut self, value: f64) -> &mut Self { self.horizontal_split.set_value(value); self } + #[inline] pub fn get_vertical_split(&self) -> &f64 { self.vertical_split.get_value() } + #[inline] pub fn set_vertical_split(&mut self, value: f64) -> &mut Self { self.vertical_split.set_value(value); self } + #[inline] pub fn get_top_left_cell(&self) -> &Coordinate { &self.top_left_cell } + #[inline] pub fn get_top_left_cell_mut(&mut self) -> &mut Coordinate { &mut self.top_left_cell } + #[inline] pub fn set_top_left_cell(&mut self, value: Coordinate) -> &mut Self { self.top_left_cell = value; self } + #[inline] pub fn get_active_pane(&self) -> &PaneValues { self.active_pane.get_value() } + #[inline] pub fn set_active_pane(&mut self, value: PaneValues) -> &mut Self { self.active_pane.set_value(value); self } + #[inline] pub fn get_state(&self) -> &PaneStateValues { self.state.get_value() } + #[inline] pub fn set_state(&mut self, value: PaneStateValues) -> &mut Self { self.state.set_value(value); self diff --git a/src/structs/pane_state_values.rs b/src/structs/pane_state_values.rs index 37fa6c92..4d08223d 100644 --- a/src/structs/pane_state_values.rs +++ b/src/structs/pane_state_values.rs @@ -7,11 +7,13 @@ pub enum PaneStateValues { Split, } impl Default for PaneStateValues { + #[inline] fn default() -> Self { Self::Split } } impl EnumTrait for PaneStateValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::Frozen => "frozen", @@ -22,6 +24,8 @@ impl EnumTrait for PaneStateValues { } impl FromStr for PaneStateValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "frozen" => Ok(Self::Frozen), diff --git a/src/structs/pane_values.rs b/src/structs/pane_values.rs index bbaee15a..e86b12be 100644 --- a/src/structs/pane_values.rs +++ b/src/structs/pane_values.rs @@ -8,11 +8,13 @@ pub enum PaneValues { TopRight, } impl Default for PaneValues { + #[inline] fn default() -> Self { Self::BottomRight } } impl EnumTrait for PaneValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::BottomLeft => "bottomLeft", @@ -24,6 +26,8 @@ impl EnumTrait for PaneValues { } impl FromStr for PaneValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "bottomLeft" => Ok(Self::BottomLeft), diff --git a/src/structs/pattern_fill.rs b/src/structs/pattern_fill.rs index ff3bf3eb..ce75a933 100644 --- a/src/structs/pattern_fill.rs +++ b/src/structs/pattern_fill.rs @@ -18,10 +18,12 @@ pub struct PatternFill { } impl PatternFill { + #[inline] pub fn get_pattern_type(&self) -> &PatternValues { self.pattern_type.get_value() } + #[inline] pub fn set_pattern_type(&mut self, value: PatternValues) -> &mut Self { self.pattern_type.set_value(value); self @@ -38,40 +40,48 @@ impl PatternFill { self } + #[inline] pub fn get_foreground_color(&self) -> Option<&Color> { self.foreground_color.as_deref() } + #[inline] pub fn get_foreground_color_mut(&mut self) -> &mut Color { self.foreground_color .get_or_insert(Box::new(Color::default())) } + #[inline] pub fn set_foreground_color(&mut self, value: Color) -> &mut Self { self.foreground_color = Some(Box::new(value)); self.auto_set_pattern_type(); self } + #[inline] pub fn remove_foreground_color(&mut self) -> &mut Self { self.foreground_color = None; self } + #[inline] pub fn get_background_color(&self) -> Option<&Color> { self.background_color.as_deref() } + #[inline] pub fn get_background_color_mut(&mut self) -> &mut Color { self.background_color .get_or_insert(Box::new(Color::default())) } + #[inline] pub fn set_background_color(&mut self, value: Color) -> &mut Self { self.background_color = Some(Box::new(value)); self } + #[inline] pub fn remove_background_color(&mut self) -> &mut Self { self.background_color = None; self diff --git a/src/structs/pattern_values.rs b/src/structs/pattern_values.rs index e30b3559..ac272ad8 100644 --- a/src/structs/pattern_values.rs +++ b/src/structs/pattern_values.rs @@ -23,11 +23,13 @@ pub enum PatternValues { Solid, } impl Default for PatternValues { + #[inline] fn default() -> Self { Self::None } } impl EnumTrait for PatternValues { + #[inline] fn get_value_string(&self) -> &str { match &self { Self::DarkDown => "darkDown", @@ -54,6 +56,8 @@ impl EnumTrait for PatternValues { } impl FromStr for PatternValues { type Err = (); + + #[inline] fn from_str(input: &str) -> Result { match input { "darkDown" => Ok(Self::DarkDown), diff --git a/src/structs/print_options.rs b/src/structs/print_options.rs index bb1988c8..d43dcc16 100644 --- a/src/structs/print_options.rs +++ b/src/structs/print_options.rs @@ -13,28 +13,34 @@ pub struct PrintOptions { } impl PrintOptions { + #[inline] pub fn get_horizontal_centered(&self) -> &bool { self.horizontal_centered.get_value() } + #[inline] pub fn set_horizontal_centered(&mut self, value: bool) -> &mut Self { self.horizontal_centered.set_value(value); self } + #[inline] pub fn get_vertical_centered(&self) -> &bool { self.vertical_centered.get_value() } + #[inline] pub fn set_vertical_centered(&mut self, value: bool) -> &mut Self { self.vertical_centered.set_value(value); self } + #[inline] pub(crate) fn has_param(&self) -> bool { self.horizontal_centered.has_value() || self.vertical_centered.has_value() } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, diff --git a/src/structs/properties.rs b/src/structs/properties.rs index 6b5d0008..b8cef694 100644 --- a/src/structs/properties.rs +++ b/src/structs/properties.rs @@ -29,6 +29,7 @@ pub struct Properties { custom_properties: CustomProperties, } impl Default for Properties { + #[inline] fn default() -> Self { let mut created = StringValue::default(); let mut modified = StringValue::default(); @@ -53,131 +54,160 @@ impl Default for Properties { } } impl Properties { + #[inline] pub fn get_creator(&self) -> &str { &self.creator.get_value_str() } + #[inline] pub fn set_creator>(&mut self, value: S) -> &mut Self { self.creator.set_value(value); self } + #[inline] pub fn get_last_modified_by(&self) -> &str { &self.last_modified_by.get_value_str() } + #[inline] pub fn set_last_modified_by>(&mut self, value: S) -> &mut Self { self.last_modified_by.set_value(value); self } + #[inline] pub fn get_created(&self) -> &str { &self.created.get_value_str() } + #[inline] pub fn set_created>(&mut self, value: S) -> &mut Self { self.created.set_value(value); self } + #[inline] pub fn get_modified(&self) -> &str { &self.modified.get_value_str() } + #[inline] pub fn set_modified>(&mut self, value: S) -> &mut Self { self.modified.set_value(value); self } + #[inline] pub fn get_title(&self) -> &str { &self.title.get_value_str() } + #[inline] pub fn set_title>(&mut self, value: S) -> &mut Self { self.title.set_value(value); self } + #[inline] pub fn get_description(&self) -> &str { &self.description.get_value_str() } + #[inline] pub fn set_description>(&mut self, value: S) -> &mut Self { self.description.set_value(value); self } + #[inline] pub fn get_subject(&self) -> &str { &self.subject.get_value_str() } + #[inline] pub fn set_subject>(&mut self, value: S) -> &mut Self { self.subject.set_value(value); self } + #[inline] pub fn get_keywords(&self) -> &str { &self.keywords.get_value_str() } + #[inline] pub fn set_keywords>(&mut self, value: S) -> &mut Self { self.keywords.set_value(value); self } + #[inline] pub fn get_revision(&self) -> &str { &self.revision.get_value_str() } + #[inline] pub fn set_revision>(&mut self, value: S) -> &mut Self { self.revision.set_value(value); self } + #[inline] pub fn get_category(&self) -> &str { &self.category.get_value_str() } + #[inline] pub fn set_category>(&mut self, value: S) -> &mut Self { self.category.set_value(value); self } + #[inline] pub fn get_version(&self) -> &str { &self.version.get_value_str() } + #[inline] pub fn set_version>(&mut self, value: S) -> &mut Self { self.version.set_value(value); self } + #[inline] pub fn get_manager(&self) -> &str { &self.manager.get_value_str() } + #[inline] pub fn set_manager>(&mut self, value: S) -> &mut Self { self.manager.set_value(value); self } + #[inline] pub fn get_company(&self) -> &str { &self.company.get_value_str() } + #[inline] pub fn set_company>(&mut self, value: S) -> &mut Self { self.company.set_value(value); self } + #[inline] pub fn get_custom_properties(&self) -> &CustomProperties { &self.custom_properties } + #[inline] pub fn get_custom_properties_mut(&mut self) -> &mut CustomProperties { &mut self.custom_properties } + #[inline] pub fn set_custom_properties(&mut self, value: CustomProperties) -> &mut Self { self.custom_properties = value; self @@ -241,6 +271,7 @@ impl Properties { ); } + #[inline] pub(crate) fn set_attributes_custom( &mut self, reader: &mut Reader, @@ -476,6 +507,7 @@ impl Properties { write_end_tag(writer, "Properties"); } + #[inline] pub(crate) fn write_to_custom(&self, writer: &mut Writer>>) { self.custom_properties.write_to(writer); } diff --git a/src/structs/protection.rs b/src/structs/protection.rs index b36cd667..ec9432e7 100644 --- a/src/structs/protection.rs +++ b/src/structs/protection.rs @@ -15,22 +15,27 @@ pub struct Protection { } impl Protection { + #[inline] pub fn get_locked(&self) -> &bool { self.locked.get_value() } + #[inline] pub fn set_locked(&mut self, value: bool) { self.locked.set_value(value); } + #[inline] pub fn get_hidden(&mut self) -> &bool { self.hidden.get_value() } + #[inline] pub fn set_hidden(&mut self, value: bool) { self.hidden.set_value(value); } + #[inline] pub(crate) fn get_hash_code(&self) -> String { format!( "{:x}", @@ -42,6 +47,7 @@ impl Protection { ) } + #[inline] pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, diff --git a/src/structs/range.rs b/src/structs/range.rs index 128a32de..bc9dadfd 100644 --- a/src/structs/range.rs +++ b/src/structs/range.rs @@ -64,6 +64,7 @@ impl Range { self } + #[inline] pub fn get_range(&self) -> String { let mut result = self.get_coordinate_start(); if self.end_col.is_some() || self.end_row.is_some() { @@ -72,34 +73,42 @@ impl Range { result } + #[inline] pub fn get_coordinate_start_col(&self) -> Option<&ColumnReference> { self.start_col.as_ref() } + #[inline] pub fn get_coordinate_start_col_mut(&mut self) -> Option<&mut ColumnReference> { self.start_col.as_mut() } + #[inline] pub fn get_coordinate_start_row(&self) -> Option<&RowReference> { self.start_row.as_ref() } + #[inline] pub fn get_coordinate_start_row_mut(&mut self) -> Option<&mut RowReference> { self.start_row.as_mut() } + #[inline] pub fn get_coordinate_end_col(&self) -> Option<&ColumnReference> { self.end_col.as_ref() } + #[inline] pub fn get_coordinate_end_col_mut(&mut self) -> Option<&mut ColumnReference> { self.end_col.as_mut() } + #[inline] pub fn get_coordinate_end_row(&self) -> Option<&RowReference> { self.end_row.as_ref() } + #[inline] pub fn get_coordinate_end_row_mut(&mut self) -> Option<&mut RowReference> { self.end_row.as_mut() } @@ -127,6 +136,7 @@ impl Range { } } impl AdjustmentCoordinate for Range { + #[inline] fn adjustment_insert_coordinate( &mut self, root_col_num: &u32, @@ -148,6 +158,7 @@ impl AdjustmentCoordinate for Range { } } + #[inline] fn adjustment_remove_coordinate( &mut self, root_col_num: &u32, @@ -169,6 +180,7 @@ impl AdjustmentCoordinate for Range { } } + #[inline] fn is_remove_coordinate( &self, root_col_num: &u32, diff --git a/src/structs/raw/raw_file.rs b/src/structs/raw/raw_file.rs index d903273b..6f6ba64c 100644 --- a/src/structs/raw/raw_file.rs +++ b/src/structs/raw/raw_file.rs @@ -12,22 +12,26 @@ pub(crate) struct RawFile { file_data: ThinVec, } impl RawFile { + #[inline] pub(crate) fn get_file_name(&self) -> String { let v: Vec<&str> = self.get_file_target().split('/').collect(); let object_name = v.last().unwrap(); object_name.to_string() } + #[inline] pub(crate) fn make_rel_name(&self) -> String { format!("_rels/{}.rels", self.get_file_name()) } + #[inline] pub(crate) fn get_path(&self) -> String { let mut v: Vec<&str> = self.get_file_target().split('/').collect(); v.pop(); v.join("/") } + #[inline] pub(crate) fn get_extension(&self) -> String { self.get_file_name() .rsplit_once('.') @@ -35,23 +39,28 @@ impl RawFile { .unwrap() } + #[inline] pub(crate) fn get_file_target(&self) -> &str { self.file_target.get_value_str() } + #[inline] pub(crate) fn set_file_target>(&mut self, value: S) -> &mut Self { self.file_target.set_value(value); self } + #[inline] pub(crate) fn get_file_data(&self) -> &[u8] { &self.file_data } + #[inline] pub(crate) fn _get_file_data_mut(&mut self) -> &mut ThinVec { &mut self.file_data } + #[inline] pub(crate) fn set_file_data(&mut self, value: &[u8]) -> &mut Self { self.file_data = value.into(); self diff --git a/src/structs/raw/raw_relationship.rs b/src/structs/raw/raw_relationship.rs index 3f48d049..1ea86c64 100644 --- a/src/structs/raw/raw_relationship.rs +++ b/src/structs/raw/raw_relationship.rs @@ -20,50 +20,61 @@ pub(crate) struct RawRelationship { } impl RawRelationship { + #[inline] pub(crate) fn get_id(&self) -> &str { self.id.get_value_str() } + #[inline] pub(crate) fn set_id>(&mut self, value: S) -> &mut Self { self.id.set_value(value); self } + #[inline] pub(crate) fn get_target(&self) -> &str { self.target.get_value_str() } + #[inline] pub(crate) fn set_target>(&mut self, value: S) -> &mut Self { self.target.set_value(value); self } + #[inline] pub(crate) fn get_type(&self) -> &str { self.r_type.get_value_str() } + #[inline] pub(crate) fn set_type>(&mut self, value: S) -> &mut Self { self.r_type.set_value(value); self } + #[inline] pub(crate) fn get_raw_file(&self) -> &RawFile { &self.raw_file } + #[inline] pub(crate) fn get_raw_file_mut(&mut self) -> &mut RawFile { &mut self.raw_file } + #[inline] pub(crate) fn _set_raw_file(&mut self, value: RawFile) -> &mut Self { self.raw_file = value; self } + #[inline] pub(crate) fn get_target_mode(&self) -> &str { self.target_mode.get_value_str() } + #[inline] pub(crate) fn set_target_mode>(&mut self, value: S) -> &mut Self { self.target_mode.set_value(value); self @@ -100,6 +111,7 @@ impl RawRelationship { write_start_tag(writer, "Relationship", attributes, true); } + #[inline] pub(crate) fn write_to_bin( &self, writer_mng: &mut WriterManager, diff --git a/src/structs/raw/raw_relationships.rs b/src/structs/raw/raw_relationships.rs index 960a28e9..e386a5be 100644 --- a/src/structs/raw/raw_relationships.rs +++ b/src/structs/raw/raw_relationships.rs @@ -19,25 +19,30 @@ pub(crate) struct RawRelationships { } impl RawRelationships { + #[inline] pub(crate) fn _get_file_name(&self) -> String { let v: Vec<&str> = self.get_file_target().split('/').collect(); let object_name = v.last().unwrap(); object_name.to_string() } + #[inline] pub(crate) fn get_file_target(&self) -> &str { self.file_target.get_value_str() } + #[inline] pub(crate) fn set_file_target>(&mut self, value: S) -> &mut Self { self.file_target.set_value(value); self } + #[inline] pub(crate) fn get_relationship_list(&self) -> &[RawRelationship] { &self.relationship_list } + #[inline] pub(crate) fn _get_relationship_list_mut(&mut self) -> &mut ThinVec { &mut self.relationship_list } @@ -51,6 +56,7 @@ impl RawRelationships { panic!("not found relationship as {}.", r_id); } + #[inline] pub(crate) fn add_relationship_list(&mut self, value: RawRelationship) -> &mut Self { self.relationship_list.push(value); self diff --git a/src/structs/raw/raw_worksheet.rs b/src/structs/raw/raw_worksheet.rs index a20d2df6..ed320edd 100644 --- a/src/structs/raw/raw_worksheet.rs +++ b/src/structs/raw/raw_worksheet.rs @@ -12,27 +12,33 @@ pub(crate) struct RawWorksheet { relationships_list: ThinVec, } impl RawWorksheet { + #[inline] pub(crate) fn get_worksheet_file(&self) -> &RawFile { &self.worksheet_file } + #[inline] pub(crate) fn get_worksheet_file_mut(&mut self) -> &mut RawFile { &mut self.worksheet_file } + #[inline] pub(crate) fn get_relationships_list(&self) -> &[RawRelationships] { &self.relationships_list } + #[inline] pub(crate) fn _get_relationships_list_mut(&mut self) -> &mut ThinVec { &mut self.relationships_list } + #[inline] pub(crate) fn set_relationships(&mut self, value: RawRelationships) -> &mut Self { self.relationships_list.push(value); self } + #[inline] pub(crate) fn get_worksheet_relationships(&self) -> Option<&RawRelationships> { self.get_relationships_list() .iter() diff --git a/src/structs/rich_text.rs b/src/structs/rich_text.rs index ad1e78ef..63f578ee 100644 --- a/src/structs/rich_text.rs +++ b/src/structs/rich_text.rs @@ -16,6 +16,7 @@ pub struct RichText { } impl RichText { + #[inline] pub fn get_text(&self) -> Cow<'static, str> { let mut text = String::from(""); for rich_text_elements in &self.rich_text_elements { @@ -24,6 +25,7 @@ impl RichText { text.into() } + #[inline] pub fn set_text>(&mut self, value: S) -> &mut Self { self.rich_text_elements.clear(); let mut text_element = TextElement::default(); @@ -32,19 +34,23 @@ impl RichText { self } + #[inline] pub fn get_rich_text_elements(&self) -> &[TextElement] { &self.rich_text_elements } + #[inline] pub fn get_rich_text_elements_mut(&mut self) -> &mut ThinVec { &mut self.rich_text_elements } + #[inline] pub fn set_rich_text_elements(&mut self, value: impl Into>) -> &mut Self { self.rich_text_elements = value.into(); self } + #[inline] pub fn add_rich_text_elements(&mut self, value: TextElement) -> &mut Self { self.rich_text_elements.push(value); self @@ -81,11 +87,13 @@ impl RichText { ); } + #[inline] pub(crate) fn write_to_none(&self, writer: &mut Writer>>) { // none self.write_to(writer, ""); } + #[inline] pub(crate) fn write_to_text(&self, writer: &mut Writer>>) { // text self.write_to(writer, "text"); diff --git a/src/structs/row.rs b/src/structs/row.rs index 18051aa1..619a78bc 100644 --- a/src/structs/row.rs +++ b/src/structs/row.rs @@ -27,6 +27,7 @@ pub struct Row { style: Box