Fixed field renaming for FieldDialogBuilder (#14)

This commit is contained in:
bicarlsen 2022-11-28 09:43:50 +01:00 committed by GitHub
parent e28a0bb749
commit 0c864ee8c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,7 +34,7 @@ struct DialogFilter<'a> {
///
/// Constructs file picker dialogs that can select single/multiple files or directories.
#[derive(Debug, Default, Clone, Hash, Serialize)]
#[serde(rename = "camelCase")]
#[serde(rename_all = "camelCase")]
pub struct FileDialogBuilder<'a> {
default_path: Option<&'a Path>,
filters: Vec<DialogFilter<'a>>,
@ -120,7 +120,10 @@ impl<'a> FileDialogBuilder<'a> {
/// # Ok(())
/// # }
/// ```
pub fn add_filters(&mut self, filters: impl IntoIterator<Item = (&'a str, &'a [&'a str])>) -> &mut Self {
pub fn add_filters(
&mut self,
filters: impl IntoIterator<Item = (&'a str, &'a [&'a str])>,
) -> &mut Self {
for (name, extensions) in filters.into_iter() {
self.filters.push(DialogFilter {
name: name.as_ref(),