Struct e_utils::dialog::blocking::FileBuilder
source · pub struct FileBuilder(/* private fields */);Expand description
The file dialog builder.
Constructs file picker dialogs that can select single/multiple files or directories.
Implementations§
source§impl FileBuilder
impl FileBuilder
sourcepub fn add_filter(self, name: impl AsRef<str>, extensions: &[&str]) -> Self
pub fn add_filter(self, name: impl AsRef<str>, extensions: &[&str]) -> Self
Add file extension filter. Takes in the name of the filter, and list of extensions
sourcepub fn set_directory<P: AsRef<Path>>(self, directory: P) -> Self
pub fn set_directory<P: AsRef<Path>>(self, directory: P) -> Self
Set starting directory of the dialog.
sourcepub fn set_file_name(self, file_name: &str) -> Self
pub fn set_file_name(self, file_name: &str) -> Self
Set starting file name of the dialog.
source§impl FileBuilder
impl FileBuilder
sourcepub fn pick_file(self) -> Option<PathBuf>
pub fn pick_file(self) -> Option<PathBuf>
Shows the dialog to select a single file. This is a blocking operation, and should NOT be used when running on the main thread context.
§Examples
use e_utils::dialog::blocking::FileBuilder;
#[tokio::main]
async fn my_command() {
let file_path = FileBuilder::new().pick_file();
// do something with the optional file path here
// the file path is `None` if the user closed the dialog
}sourcepub fn pick_files(self) -> Option<Vec<PathBuf>>
pub fn pick_files(self) -> Option<Vec<PathBuf>>
Shows the dialog to select multiple files. This is a blocking operation, and should NOT be used when running on the main thread context.
§Examples
use e_utils::dialog::blocking::FileBuilder;
#[tokio::main]
async fn my_command() {
let file_path = FileBuilder::new().pick_files();
// do something with the optional file paths here
// the file paths value is `None` if the user closed the dialog
}sourcepub fn pick_folder(self) -> Option<PathBuf>
pub fn pick_folder(self) -> Option<PathBuf>
Shows the dialog to select a single folder. This is a blocking operation, and should NOT be used when running on the main thread context.
§Examples
use e_utils::dialog::blocking::FileBuilder;
#[tokio::main]
async fn my_command() {
let folder_path = FileBuilder::new().pick_folder();
// do something with the optional folder path here
// the folder path is `None` if the user closed the dialog
}sourcepub fn pick_folders(self) -> Option<Vec<PathBuf>>
pub fn pick_folders(self) -> Option<Vec<PathBuf>>
Shows the dialog to select multiple folders. This is a blocking operation, and should NOT be used when running on the main thread context.
§Examples
use e_utils::dialog::blocking::FileBuilder;
#[tokio::main]
async fn my_command() {
let folder_paths = FileBuilder::new().pick_folders();
// do something with the optional folder paths here
// the folder paths value is `None` if the user closed the dialog
}sourcepub fn save_file(self) -> Option<PathBuf>
pub fn save_file(self) -> Option<PathBuf>
Shows the dialog to save a file. This is a blocking operation, and should NOT be used when running on the main thread context.
§Examples
use e_utils::dialog::blocking::FileBuilder;
#[tokio::main]
async fn my_command() {
let file_path = FileBuilder::new().save_file();
// do something with the optional file path here
// the file path is `None` if the user closed the dialog
}Trait Implementations§
source§impl Debug for FileBuilder
impl Debug for FileBuilder
source§impl Default for FileBuilder
impl Default for FileBuilder
source§fn default() -> FileBuilder
fn default() -> FileBuilder
Auto Trait Implementations§
impl Freeze for FileBuilder
impl RefUnwindSafe for FileBuilder
impl Send for FileBuilder
impl Sync for FileBuilder
impl Unpin for FileBuilder
impl UnwindSafe for FileBuilder
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
source§fn null_value() -> T
fn null_value() -> T
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().