pub struct PlatformFolder { /* private fields */ }Expand description
A folder the user chose in a folder dialog, or found inside one.
Desktop folders have a filesystem path. Web and Android folders do not, so portable code lists, opens, and creates entries through the folder itself. Entries are named by a single name, never a path, so a folder reaches only what is directly inside it.
Implementations§
Source§impl PlatformFolder
impl PlatformFolder
pub fn name(&self) -> String
Sourcepub fn path(&self) -> Option<&Path>
pub fn path(&self) -> Option<&Path>
The folder’s path on desktop platforms, None on the web and Android.
Sourcepub async fn entries(&self) -> Result<Vec<FolderEntry>, Error>
pub async fn entries(&self) -> Result<Vec<FolderEntry>, Error>
The files and folders directly inside this folder, in no particular order.
Sourcepub async fn file(&self, name: &str) -> Result<Option<PlatformFile>, Error>
pub async fn file(&self, name: &str) -> Result<Option<PlatformFile>, Error>
The file called name in this folder, or None when there is none.
Sourcepub async fn folder(&self, name: &str) -> Result<Option<PlatformFolder>, Error>
pub async fn folder(&self, name: &str) -> Result<Option<PlatformFolder>, Error>
The folder called name in this folder, or None when there is none.
Sourcepub async fn create_file(&self, name: &str) -> Result<PlatformFile, Error>
pub async fn create_file(&self, name: &str) -> Result<PlatformFile, Error>
The file called name in this folder, created empty when there is
none. An existing file keeps its contents; a folder with that name is
an error.
Sourcepub async fn create_folder(&self, name: &str) -> Result<PlatformFolder, Error>
pub async fn create_folder(&self, name: &str) -> Result<PlatformFolder, Error>
The folder called name in this folder, created when there is none.
A file with that name is an error.
Trait Implementations§
Source§impl Clone for PlatformFolder
impl Clone for PlatformFolder
Source§fn clone(&self) -> PlatformFolder
fn clone(&self) -> PlatformFolder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Forget for PlatformFolder
impl Freeze for PlatformFolder
impl Move for PlatformFolder
impl RefUnwindSafe for PlatformFolder
impl Send for PlatformFolder
impl Sync for PlatformFolder
impl Unpin for PlatformFolder
impl UnsafeUnpin for PlatformFolder
impl UnwindSafe for PlatformFolder
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.