pub struct FileDialog {
pub mode: FileDialogMode,
pub multiple: bool,
pub title: Option<String>,
pub filters: Vec<FileFilter>,
pub directory: Option<String>,
pub file_name: Option<String>,
pub tag: Value,
}Expand description
An Open, Save or folder dialog, as an app asks for one.
Fields§
§mode: FileDialogMode§multiple: boolMore than one file or folder may be picked (Open and Folder).
title: Option<String>The dialog’s title, where the platform shows one.
filters: Vec<FileFilter>The file types offered, the first one chosen; none is any file.
directory: Option<String>The folder it opens in; the platform’s choice when absent.
file_name: Option<String>A Save dialog’s suggested name.
tag: ValueHanded back on the files event, as a node’s tag is.
Implementations§
Source§impl FileDialog
impl FileDialog
Sourcepub fn open() -> FileDialog
pub fn open() -> FileDialog
An Open dialog for one existing file.
Sourcepub fn save() -> FileDialog
pub fn save() -> FileDialog
A Save dialog.
Sourcepub fn folder() -> FileDialog
pub fn folder() -> FileDialog
A folder picker.
pub fn multiple(self) -> FileDialog
pub fn title(self, title: impl Into<String>) -> FileDialog
Sourcepub fn filter(self, name: impl Into<String>, extensions: &[&str]) -> FileDialog
pub fn filter(self, name: impl Into<String>, extensions: &[&str]) -> FileDialog
Offers the file type name, matching extensions (without the
dot; one written with it is taken without). The first filter added
is the one chosen when it opens.
pub fn directory(self, dir: impl Into<String>) -> FileDialog
pub fn file_name(self, name: impl Into<String>) -> FileDialog
pub fn tag(self, tag: impl Into<Value>) -> FileDialog
Sourcepub fn to_value(&self) -> Value
pub fn to_value(&self) -> Value
The ask as plain data — {mode, multiple, title?, filters: [{name, extensions}], directory?, fileName?, tag} — what a Node host’s
takeFileRequests hands out and a script’s request_files takes.
Sourcepub fn from_value(v: &Value) -> Result<FileDialog, String>
pub fn from_value(v: &Value) -> Result<FileDialog, String>
Reads the plain-data shape back, file_name or fileName alike.
Err names what is wrong: an unknown mode, a filter without a name
or with extensions that are not strings.
Trait Implementations§
Source§impl Clone for FileDialog
impl Clone for FileDialog
Source§fn clone(&self) -> FileDialog
fn clone(&self) -> FileDialog
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FileDialog
impl Debug for FileDialog
Source§impl Default for FileDialog
impl Default for FileDialog
Source§fn default() -> FileDialog
fn default() -> FileDialog
Source§impl PartialEq for FileDialog
impl PartialEq for FileDialog
impl StructuralPartialEq for FileDialog
Auto Trait Implementations§
impl Freeze for FileDialog
impl RefUnwindSafe for FileDialog
impl Send for FileDialog
impl Sync for FileDialog
impl Unpin for FileDialog
impl UnsafeUnpin for FileDialog
impl UnwindSafe for FileDialog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.