Struct rfd::FileHandle
source · [−]pub struct FileHandle(_);
Expand description
FileHandle is a way of abstracting over a file returned by a dialog
Implementations
sourceimpl FileHandle
impl FileHandle
sourcepub fn wrap(path_buf: PathBuf) -> Self
pub fn wrap(path_buf: PathBuf) -> Self
On native platforms it wraps path.
On WASM32
it wraps JS File
object.
sourcepub async fn read(&self) -> Vec<u8>
pub async fn read(&self) -> Vec<u8>
Reads a file asynchronously.
On native platforms it spawns a std::thread
in the background.
This fn exists souly to keep native api in pair with async only web api.
sourcepub fn inner(&self) -> &Path
pub fn inner(&self) -> &Path
Unwraps a FileHandle
and returns innet type.
It should be used, if user wants to handle file read themselves
On native platforms returns path.
On WASM32
it returns JS File
object.
Behind a file-handle-inner
feature flag
Trait Implementations
sourceimpl Debug for FileHandle
impl Debug for FileHandle
sourceimpl From<&FileHandle> for PathBuf
impl From<&FileHandle> for PathBuf
sourcefn from(file_handle: &FileHandle) -> Self
fn from(file_handle: &FileHandle) -> Self
Converts to this type from the input type.
sourceimpl From<FileHandle> for PathBuf
impl From<FileHandle> for PathBuf
sourcefn from(file_handle: FileHandle) -> Self
fn from(file_handle: FileHandle) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl RefUnwindSafe for FileHandle
impl Send for FileHandle
impl Sync for FileHandle
impl Unpin for FileHandle
impl UnwindSafe for FileHandle
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more