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
pub fn multiple(self) -> Self
pub fn title(self, title: impl Into<String>) -> Self
Sourcepub fn filter(self, name: impl Into<String>, extensions: &[&str]) -> Self
pub fn filter(self, name: impl Into<String>, extensions: &[&str]) -> Self
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>) -> Self
pub fn file_name(self, name: impl Into<String>) -> Self
pub fn tag(self, tag: impl Into<Value>) -> Self
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<Self, String>
pub fn from_value(v: &Value) -> Result<Self, 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.