Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change a few method signatures #117

Merged
merged 1 commit into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/file_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl FileDialog {
/// * Linux
///
/// On platforms that don't support filter names, all filters will be merged into one filter
pub fn add_filter(mut self, name: &str, extensions: &[&str]) -> Self {
pub fn add_filter(mut self, name: impl Into<String>, extensions: &[impl ToString]) -> Self {
somedevfox marked this conversation as resolved.
Show resolved Hide resolved
self.filters.push(Filter {
name: name.into(),
extensions: extensions.iter().map(|e| e.to_string()).collect(),
Expand All @@ -71,7 +71,7 @@ impl FileDialog {
/// * Windows
/// * Linux
/// * Mac
pub fn set_file_name(mut self, file_name: &str) -> Self {
pub fn set_file_name(mut self, file_name: impl Into<String>) -> Self {
self.file_name = Some(file_name.into());
self
}
Expand All @@ -80,7 +80,7 @@ impl FileDialog {
/// * Windows
/// * Linux
/// * Mac (Only below version 10.11)
pub fn set_title(mut self, title: &str) -> Self {
pub fn set_title(mut self, title: impl Into<String>) -> Self {
self.title = Some(title.into());
self
}
Expand Down Expand Up @@ -163,7 +163,7 @@ impl AsyncFileDialog {
/// * Linux
///
/// On platforms that don't support filter names, all filters will be merged into one filter
pub fn add_filter(mut self, name: &str, extensions: &[&str]) -> Self {
pub fn add_filter(mut self, name: impl Into<String>, extensions: &[impl ToString]) -> Self {
self.file_dialog = self.file_dialog.add_filter(name, extensions);
self
}
Expand All @@ -181,7 +181,7 @@ impl AsyncFileDialog {
/// * Windows
/// * Linux
/// * Mac
pub fn set_file_name(mut self, file_name: &str) -> Self {
pub fn set_file_name(mut self, file_name: impl Into<String>) -> Self {
self.file_dialog = self.file_dialog.set_file_name(file_name);
self
}
Expand All @@ -190,7 +190,7 @@ impl AsyncFileDialog {
/// * Windows
/// * Linux
/// * Mac (Only below version 10.11)
pub fn set_title(mut self, title: &str) -> Self {
pub fn set_title(mut self, title: impl Into<String>) -> Self {
self.file_dialog = self.file_dialog.set_title(title);
self
}
Expand Down
8 changes: 4 additions & 4 deletions src/message_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ impl MessageDialog {
}

/// Set title of a dialog
pub fn set_title(mut self, text: &str) -> Self {
pub fn set_title(mut self, text: impl Into<String>) -> Self {
self.title = text.into();
self
}

/// Set description of a dialog
///
/// Description is a content of a dialog
pub fn set_description(mut self, text: &str) -> Self {
pub fn set_description(mut self, text: impl Into<String>) -> Self {
self.description = text.into();
self
}
Expand Down Expand Up @@ -101,15 +101,15 @@ impl AsyncMessageDialog {
}

/// Set title of a dialog
pub fn set_title(mut self, text: &str) -> Self {
pub fn set_title(mut self, text: impl Into<String>) -> Self {
self.0 = self.0.set_title(text);
self
}

/// Set description of a dialog
///
/// Description is a content of a dialog
pub fn set_description(mut self, text: &str) -> Self {
pub fn set_description(mut self, text: impl Into<String>) -> Self {
self.0 = self.0.set_description(text);
self
}
Expand Down