Struct FileDialog

Source
pub struct FileDialog {
    pub filename: Option<String>,
    pub location: Option<PathBuf>,
    pub filters: Vec<Filter>,
    pub title: Option<String>,
}
Expand description

Builds and shows file dialogs.

Fields§

§filename: Option<String>§location: Option<PathBuf>§filters: Vec<Filter>§title: Option<String>

Implementations§

Source§

impl FileDialog

Source

pub fn new() -> Self

Creates a file dialog builder.

Source

pub fn set_title(self, title: String) -> Self

Sets the window title for the dialog.

Source

pub fn set_filename(self, filename: String) -> Self

Sets the default value of the filename text field in the dialog. For open dialogs of macOS and zenity, this is a no-op because there’s no such text field on the dialog.

Source

pub fn reset_filename(self) -> Self

Resets the default value of the filename field in the dialog.

Source

pub fn set_location(self, path: PathBuf) -> Self

Sets the default location that the dialog shows at open.

Source

pub fn reset_location(self) -> Self

Resets the default location that the dialog shows at open. Without a default location set, the dialog will probably use the current working directory as default location.

Source

pub fn add_filter(self, description: String, extensions: Vec<String>) -> Self

Adds a file type filter. The filter must contains at least one extension, otherwise this method will panic. For dialogs that open directories, this is a no-op.

Source

pub fn remove_all_filters(self) -> Self

Removes all file type filters.

Trait Implementations§

Source§

impl Debug for FileDialog

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FileDialog

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for FileDialog

Source§

fn eq(&self, other: &FileDialog) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for FileDialog

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> ActionTrait for T
where T: 'static + Debug + ?Sized,

Source§

fn debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Source§

fn ref_cast_type_id(&self) -> TypeId
where Self: 'static,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.