pub struct OpenFiles { /* private fields */ }Expand description
A native “open files” picker that lets the user choose several files at once. .await
(or .present().await) resolves to the chosen FileUrls in the picker’s order, or an
empty Vec if the user cancels.
ⓘ
let tracks = open_files().filter("Audio", &["mp3", "flac"]).await;
for track in &tracks { library.add(track.read()?); }Implementations§
Source§impl OpenFiles
impl OpenFiles
Sourcepub fn title<M>(self, t: impl IntoText<M>) -> OpenFiles
pub fn title<M>(self, t: impl IntoText<M>) -> OpenFiles
Override the picker’s title (localizable via tr()).
Sourcepub fn filter(self, name: impl Into<String>, extensions: &[&str]) -> OpenFiles
pub fn filter(self, name: impl Into<String>, extensions: &[&str]) -> OpenFiles
Add a named file-type filter, e.g. .filter("Audio", &["mp3", "flac"]). No filter = all files.
pub async fn present(self) -> Vec<FileUrl>
Trait Implementations§
Source§impl IntoFuture for OpenFiles
impl IntoFuture for OpenFiles
Source§type IntoFuture = Pin<Box<dyn Future<Output = Vec<FileUrl>>>>
type IntoFuture = Pin<Box<dyn Future<Output = Vec<FileUrl>>>>
Which kind of future are we turning this into?
Source§fn into_future(self) -> <OpenFiles as IntoFuture>::IntoFuture
fn into_future(self) -> <OpenFiles as IntoFuture>::IntoFuture
Creates a future from a value. Read more
Auto Trait Implementations§
impl Freeze for OpenFiles
impl RefUnwindSafe for OpenFiles
impl Send for OpenFiles
impl Sync for OpenFiles
impl Unpin for OpenFiles
impl UnsafeUnpin for OpenFiles
impl UnwindSafe for OpenFiles
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
Mutably borrows from an owned value. Read more
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
Converts
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> ⓘ
Converts
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 more