From dddd6de4112dab4b311d57c3a4b6319611ddc85e Mon Sep 17 00:00:00 2001 From: hasezoey Date: Mon, 15 Jan 2024 14:47:12 +0100 Subject: [PATCH] refactor(global): suggest inline for opaque / trivial functions --- src/global.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/global.rs b/src/global.rs index f4c7c6aa..1022836e 100644 --- a/src/global.rs +++ b/src/global.rs @@ -106,56 +106,69 @@ pub struct TableOptions<'a> { } impl<'a> TableOptions<'a> { + #[inline] pub fn get_ignore(&self) -> bool { self.ignore.unwrap_or_default() } + #[inline] #[cfg(feature = "tsync")] pub fn get_tsync(&self) -> bool { self.tsync.unwrap_or_default() } + #[inline] #[cfg(feature = "async")] pub fn get_async(&self) -> bool { self.use_async.unwrap_or_default() } + #[inline] pub fn get_serde(&self) -> bool { self.use_serde } + #[inline] pub fn get_fns(&self) -> bool { self.fns } + #[inline] pub fn get_create_str_type(&self) -> StringType { self.create_str_type } + #[inline] pub fn get_update_str_type(&self) -> StringType { self.update_str_type } + #[inline] pub fn get_create_bytes_type(&self) -> BytesType { self.create_bytes_type } + #[inline] pub fn get_update_bytes_type(&self) -> BytesType { self.update_bytes_type } + #[inline] pub fn get_autogenerated_columns(&self) -> &[&'_ str] { self.autogenerated_columns.as_deref().unwrap_or_default() } + #[inline] pub fn get_readonly(&self) -> bool { self.read_only } + #[inline] pub fn get_single_model_file(&self) -> bool { self.single_model_file } + #[inline] pub fn ignore(self) -> Self { Self { ignore: Some(true), @@ -163,6 +176,7 @@ impl<'a> TableOptions<'a> { } } + #[inline] #[cfg(feature = "tsync")] pub fn tsync(self) -> Self { Self { @@ -171,6 +185,7 @@ impl<'a> TableOptions<'a> { } } + #[inline] #[cfg(feature = "async")] pub fn use_async(self) -> Self { Self { @@ -179,6 +194,7 @@ impl<'a> TableOptions<'a> { } } + #[inline] pub fn disable_serde(self) -> Self { Self { use_serde: false, @@ -186,10 +202,12 @@ impl<'a> TableOptions<'a> { } } + #[inline] pub fn disable_fns(self) -> Self { Self { fns: false, ..self } } + #[inline] pub fn single_model_file(self) -> Self { Self { single_model_file: true, @@ -197,6 +215,7 @@ impl<'a> TableOptions<'a> { } } + #[inline] pub fn autogenerated_columns(self, cols: Vec<&'a str>) -> Self { Self { autogenerated_columns: Some(cols), @@ -204,6 +223,7 @@ impl<'a> TableOptions<'a> { } } + #[inline] pub fn create_str_type(self, type_: StringType) -> Self { Self { create_str_type: type_, @@ -211,6 +231,7 @@ impl<'a> TableOptions<'a> { } } + #[inline] pub fn update_str_type(self, type_: StringType) -> Self { Self { update_str_type: type_, @@ -218,6 +239,7 @@ impl<'a> TableOptions<'a> { } } + #[inline] pub fn create_bytes_type(self, type_: BytesType) -> Self { Self { create_bytes_type: type_, @@ -225,6 +247,7 @@ impl<'a> TableOptions<'a> { } } + #[inline] pub fn update_bytes_type(self, type_: BytesType) -> Self { Self { update_bytes_type: type_, @@ -232,6 +255,7 @@ impl<'a> TableOptions<'a> { } } + #[inline] pub fn set_read_only(&mut self, value: bool) { self.read_only = value; }