pub struct PlatformFile { /* private fields */ }Implementations§
Source§impl PlatformFile
impl PlatformFile
pub fn from_path( name: impl Into<String>, path: impl Into<PathBuf>, ) -> PlatformFile
Sourcepub fn mime_type(&self) -> Option<String>
pub fn mime_type(&self) -> Option<String>
Returns the resolved MIME when available (Android from
ContentResolver.getType, WASM from the blob’s hint), otherwise
derives from the name’s extension.
pub fn path(&self) -> Option<&Path>
Sourcepub fn uri(&self) -> Option<&str>
pub fn uri(&self) -> Option<&str>
Content URI on Android. Always returns None on platforms where the
file wasn’t sourced from a SAF picker. Haven’t gated it for checks
Sourcepub fn data(&self) -> Option<&Bytes>
pub fn data(&self) -> Option<&Bytes>
In-memory bytes on WASM. Always returns None on platforms where the
file wasn’t sourced from a blob picker. Haven’t gated it for checks
Sourcepub fn size(&self) -> Option<u64>
pub fn size(&self) -> Option<u64>
Cached size. None if not resolved at construction (desktop, or Android
pickers that didn’t query the size).
pub fn read_bytes(&self) -> Result<Bytes, RlobKitError>
pub async fn read_bytes_async(&self) -> Result<Bytes, RlobKitError>
pub fn write_bytes(&self, data: &[u8]) -> Result<(), RlobKitError>
pub fn write_string(&self, s: &str) -> Result<(), RlobKitError>
Trait Implementations§
Source§impl Clone for PlatformFile
impl Clone for PlatformFile
Source§fn clone(&self) -> PlatformFile
fn clone(&self) -> PlatformFile
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PlatformFile
impl Debug for PlatformFile
impl Eq for PlatformFile
Source§impl PartialEq for PlatformFile
impl PartialEq for PlatformFile
Source§fn eq(&self, other: &PlatformFile) -> bool
fn eq(&self, other: &PlatformFile) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for PlatformFile
Auto Trait Implementations§
impl !Freeze for PlatformFile
impl RefUnwindSafe for PlatformFile
impl Send for PlatformFile
impl Sync for PlatformFile
impl Unpin for PlatformFile
impl UnsafeUnpin for PlatformFile
impl UnwindSafe for PlatformFile
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<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>
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>
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)
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)
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.