pub struct FileDialog<'w, 's, 'a> { /* private fields */ }
Expand description

File dialog for saving/loading files. You can further customize what can be saved/loaded and the initial state of dialog with its functions.

Implementations§

source§

impl<'w, 's, 'a> FileDialog<'w, 's, 'a>

source

pub fn pick_directory_path<T: PickDirectoryPath>(self)

Open pick directory dialog and send DialogDirectoryPicked<T> event. You can read this event with Bevy’s EventReader<DialogDirectoryPicked<T>>.

Does not exist in wasm32.

source

pub fn pick_multiple_directory_paths<T: PickDirectoryPath>(self)

Open pick multiple directories dialog and send DialogDirectoryPicked<T> for each selected directory path. You can get each path by reading every event received with with Bevy’s EventReader<DialogDirectoryPicked<T>>.

Does not exist in wasm32.

source

pub fn pick_file_path<T: PickFilePath>(self)

Open pick file dialog and send DialogFilePicked<T> event. You can read this event with Bevy’s EventReader<DialogFilePicked<T>>.

Does not exist in wasm32. If you want cross-platform solution, you need to use FileDialog::load_file, which does picking and loading in one step which is compatible with wasm.

source

pub fn pick_multiple_file_paths<T: PickDirectoryPath>(self)

Open pick multiple files dialog and send DialogFilePicked<T> for each selected file path. You can get each path by reading every event received with with Bevy’s EventReader<DialogFilePicked<T>>.

Does not exist in wasm32. If you want cross-platform solution, you need to use FileDialog::load_multiple_files, which does picking and loading in one step which is compatible with wasm.

source§

impl<'w, 's, 'a> FileDialog<'w, 's, 'a>

source

pub fn add_filter( self, name: impl Into<String>, extensions: &[impl ToString] ) -> Self

Add file extension filter.

Takes in the name of the filter, and list of extensions

The name of the filter will be displayed on supported platforms:

  • Windows
  • Linux

On platforms that don’t support filter names, all filters will be merged into one filter

source

pub fn set_directory<P: AsRef<Path>>(self, path: P) -> Self

Set starting directory of the dialog. Supported platforms:

source

pub fn set_file_name(self, file_name: impl Into<String>) -> Self

Set starting file name of the dialog. Supported platforms:

  • Windows
  • Linux
  • Mac
source

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

Set the title of the dialog. Supported platforms:

  • Windows
  • Linux
  • Mac (Only below version 10.11)
  • WASM32
source

pub fn save_file<T: SaveContents>(self, contents: Vec<u8>)

Open save file dialog and save the contents to that file. When file gets saved, the DialogFileSaved<T> gets sent. You can get read this event with Bevy’s EventReader<DialogFileSaved<T>> system param.

source

pub fn load_file<T: LoadContents>(self)

Open pick file dialog and load its contents. When file contents get loaded, the DialogFileLoaded<T> gets sent. You can read this event with Bevy’s EventReader<DialogFileLoaded<T>>.

source

pub fn load_multiple_files<T: LoadContents>(self)

Open pick file dialog for multiple files and load contents for all selected files. When file contents get loaded, the DialogFileLoaded<T> gets sent for each file. You can read each file by reading every event received with with Bevy’s EventReader<DialogFileLoaded<T>>.

Auto Trait Implementations§

§

impl<'w, 's, 'a> RefUnwindSafe for FileDialog<'w, 's, 'a>

§

impl<'w, 's, 'a> Send for FileDialog<'w, 's, 'a>

§

impl<'w, 's, 'a> Sync for FileDialog<'w, 's, 'a>

§

impl<'w, 's, 'a> Unpin for FileDialog<'w, 's, 'a>

§

impl<'w, 's, 'a> !UnwindSafe for FileDialog<'w, 's, 'a>

Blanket Implementations§

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> Downcast for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> LoadContents for T
where T: Send + Sync + 'static,

source§

impl<T> PickDirectoryPath for T
where T: Send + Sync + 'static,

source§

impl<T> PickFilePath for T
where T: Send + Sync + 'static,

source§

impl<T> SaveContents for T
where T: Send + Sync + 'static,