From: Olaf Wintermann Date: Tue, 11 Aug 2026 19:47:46 +0000 (+0200) Subject: refactor set_states/set_visibility_states function to use generic Into instead... X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=9a97b1cf66e642e00798d96e1b9512f74e5fe334;p=note.git refactor set_states/set_visibility_states function to use generic Into instead of i32 directly --- diff --git a/ui-rs/src/ui/button.rs b/ui-rs/src/ui/button.rs index 7a90549..ded533b 100644 --- a/ui-rs/src/ui/button.rs +++ b/ui-rs/src/ui/button.rs @@ -400,14 +400,16 @@ impl<'a, T> ButtonBuilder<'a, T> { self } - pub fn visibility_states(&mut self, states: &[i32]) -> &mut Self { + pub fn visibility_states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_button_args_set_visibility_states(self.args, states.as_ptr(), states.len() as c_int); } self } - pub fn states(&mut self, states: &[i32]) -> &mut Self { + pub fn states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_button_args_set_states(self.args, states.as_ptr(), states.len() as c_int); } @@ -592,14 +594,16 @@ impl<'a, T> ToggleBuilder<'a, T> { self } - pub fn visibility_states(&mut self, states: &[i32]) -> &mut Self { + pub fn visibility_states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_toggle_args_set_visibility_states(self.args, states.as_ptr(), states.len() as c_int); } self } - pub fn states(&mut self, states: &[i32]) -> &mut Self { + pub fn states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_toggle_args_set_states(self.args, states.as_ptr(), states.len() as c_int); } @@ -777,14 +781,16 @@ impl<'a, T> LinkButtonBuilder<'a, T> { self } - pub fn visibility_states(&mut self, states: &[i32]) -> &mut Self { + pub fn visibility_states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_linkbutton_args_set_visibility_states(self.args, states.as_ptr(), states.len() as c_int); } self } - pub fn states(&mut self, states: &[i32]) -> &mut Self { + pub fn states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_linkbutton_args_set_states(self.args, states.as_ptr(), states.len() as c_int); } diff --git a/ui-rs/src/ui/container.rs b/ui-rs/src/ui/container.rs index 3897769..83ec79b 100644 --- a/ui-rs/src/ui/container.rs +++ b/ui-rs/src/ui/container.rs @@ -463,7 +463,8 @@ impl<'a, T> ContainerBuilder<'a, T> { self } - pub fn visibility_states(&mut self, states: &[i32]) -> &mut Self { + pub fn visibility_states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_container_args_set_visibility_states(self.args, states.as_ptr(), states.len() as c_int); } @@ -706,7 +707,8 @@ impl<'a, T> FrameBuilder<'a, T> { self } - pub fn visibility_states(&mut self, states: &[i32]) -> &mut Self { + pub fn visibility_states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_frame_args_set_visibility_states(self.args, states.as_ptr(), states.len() as c_int); } @@ -911,7 +913,8 @@ impl<'a, T> SplitPaneBuilder<'a, T> { self } - pub fn visibility_states(&mut self, states: &[i32]) -> &mut Self { + pub fn visibility_states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_splitpane_args_set_visibility_states(self.args, states.as_ptr(), states.len() as c_int); } @@ -1289,7 +1292,8 @@ impl<'a, T> TabViewBuilder<'a, T> { self } - pub fn visibility_states(&mut self, states: &[i32]) -> &mut Self { + pub fn visibility_states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_tabview_args_set_visibility_states(self.args, states.as_ptr(), states.len() as c_int); } diff --git a/ui-rs/src/ui/image.rs b/ui-rs/src/ui/image.rs index 042a2d4..a97e546 100644 --- a/ui-rs/src/ui/image.rs +++ b/ui-rs/src/ui/image.rs @@ -321,7 +321,8 @@ impl<'a, T> ImageViewerBuilder<'a, T> { self } - pub fn visibility_states(&mut self, states: &[i32]) -> &mut Self { + pub fn visibility_states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_imageviewer_args_set_visibility_states(self.args, states.as_ptr(), states.len() as c_int); } diff --git a/ui-rs/src/ui/label.rs b/ui-rs/src/ui/label.rs index 14de16a..11264a7 100644 --- a/ui-rs/src/ui/label.rs +++ b/ui-rs/src/ui/label.rs @@ -283,14 +283,16 @@ impl<'a, T> LabelBuilder<'a, T> { self } - pub fn visibility_states(&mut self, states: &[i32]) -> &mut Self { + pub fn visibility_states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_label_args_set_visibility_states(self.args, states.as_ptr(), states.len() as c_int); } self } - pub fn states(&mut self, states: &[i32]) -> &mut Self { + pub fn states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_label_args_set_states(self.args, states.as_ptr(), states.len() as c_int); } diff --git a/ui-rs/src/ui/list.rs b/ui-rs/src/ui/list.rs index 3bb7c69..bbb7c29 100644 --- a/ui-rs/src/ui/list.rs +++ b/ui-rs/src/ui/list.rs @@ -381,14 +381,16 @@ impl<'a, T, E> ListViewBuilder<'a, T, E> { self } - pub fn visibility_states(&mut self, states: &[i32]) -> &mut Self { + pub fn visibility_states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_list_args_set_visibility_states(self.args, states.as_ptr(), states.len() as c_int); } self } - pub fn states(&mut self, states: &[i32]) -> &mut Self { + pub fn states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_list_args_set_states(self.args, states.as_ptr(), states.len() as c_int); } @@ -620,14 +622,16 @@ impl<'a, T, E> TableViewBuilder<'a, T, E> { } - pub fn visibility_states(&mut self, states: &[i32]) -> &mut Self { + pub fn visibility_states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_list_args_set_visibility_states(self.args, states.as_ptr(), states.len() as c_int); } self } - pub fn states(&mut self, states: &[i32]) -> &mut Self { + pub fn states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_list_args_set_states(self.args, states.as_ptr(), states.len() as c_int); } @@ -811,14 +815,16 @@ impl<'a, T, E> SourceListBuilder<'a, T, E> { self } - pub fn visibility_states(&mut self, states: &[i32]) -> &mut Self { + pub fn visibility_states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_sourcelist_args_set_visibility_states(self.args, states.as_ptr(), states.len() as c_int); } self } - pub fn states(&mut self, states: &[i32]) -> &mut Self { + pub fn states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_sourcelist_args_set_states(self.args, states.as_ptr(), states.len() as c_int); } diff --git a/ui-rs/src/ui/text.rs b/ui-rs/src/ui/text.rs index 5eb92ab..ca67ffc 100644 --- a/ui-rs/src/ui/text.rs +++ b/ui-rs/src/ui/text.rs @@ -308,14 +308,16 @@ impl<'a, T> TextAreaBuilder<'a, T> { self } - pub fn visibility_states(&mut self, states: &[i32]) -> &mut Self { + pub fn visibility_states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_textarea_args_set_visibility_states(self.args, states.as_ptr(), states.len() as c_int); } self } - pub fn states(&mut self, states: &[i32]) -> &mut Self { + pub fn states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_textarea_args_set_states(self.args, states.as_ptr(), states.len() as c_int); } @@ -620,14 +622,16 @@ impl<'a, T> TextFieldBuilder<'a, T> { self } - pub fn visibility_states(&mut self, states: &[i32]) -> &mut Self { + pub fn visibility_states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_textfield_args_set_visibility_states(self.args, states.as_ptr(), states.len() as c_int); } self } - pub fn states(&mut self, states: &[i32]) -> &mut Self { + pub fn states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_textfield_args_set_states(self.args, states.as_ptr(), states.len() as c_int); } diff --git a/ui-rs/src/ui/webview.rs b/ui-rs/src/ui/webview.rs index 8d572f7..c15b5c8 100644 --- a/ui-rs/src/ui/webview.rs +++ b/ui-rs/src/ui/webview.rs @@ -217,14 +217,16 @@ impl<'a, T> WebViewBuilder<'a, T> { self } - pub fn visibility_states(&mut self, states: &[i32]) -> &mut Self { + pub fn visibility_state>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_webview_args_set_visibility_states(self.args, states.as_ptr(), states.len() as c_int); } self } - pub fn states(&mut self, states: &[i32]) -> &mut Self { + pub fn states>(&mut self, states: &[S]) -> &mut Self { + let states: Vec = states.iter().copied().map(Into::into).collect(); unsafe { ui_webview_args_set_states(self.args, states.as_ptr(), states.len() as c_int); }