Skip to main content

PickedFile

Struct PickedFile 

Source
#[non_exhaustive]
pub struct PickedFile { pub name: String, pub mime: String, pub data: ImageData, pub size: Size<DevicePixels>, pub last_modified: Option<SystemTime>, pub len: u64, pub status: PickedStatus, }
Expand description

A file the user picked: what the app gets as a File.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§name: String

Its name, with an extension that matches Self::mime (IMG_0042.jpg).

§mime: String

Its media type (image/jpeg).

§data: ImageData

Its bytes, shared with the File and with an Image showing it.

§size: Size<DevicePixels>

Its size in pixels, with its orientation applied (as it shows); zero when the platform does not say, then read from the bytes.

§last_modified: Option<SystemTime>

When it was last changed (File.lastModified); None: when the app gets it.

§len: u64

Its size in bytes: its bytes’ length, or for a file not read, the size its system gave (a pick of files fills it in, finish_files).

§status: PickedStatus

Whether its bytes were read.

Implementations§

Source§

impl PickedFile

Source

pub fn new( name: impl Into<String>, mime: impl Into<String>, data: ImageData, ) -> Self

The file name of type mime holding data (its size read from the bytes).

Source

pub fn too_large( name: impl Into<String>, mime: impl Into<String>, len: u64, ) -> Self

The file name of len bytes, too large to read (PickedStatus::TooLarge): no bytes, its type what its name says when mime is empty (finish_files).

Source

pub fn fill_in(&mut self)

Completes what the platform left out: the size from the bytes, the type from them or the name, and an extension matching the type.

Trait Implementations§

Source§

impl Clone for PickedFile

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PickedFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PickedFile

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for PickedFile

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PickedFile

Auto Trait Implementations§

§

impl !RefUnwindSafe for PickedFile

§

impl !UnwindSafe for PickedFile

§

impl Forget for PickedFile

§

impl Freeze for PickedFile
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const ArcInner<dyn AsRef<[u8]> + Send + Sync> is !null: Freeze, PhantomData<ArcInner<dyn AsRef<[u8]> + Send + Sync>>: Freeze, *const ArcInner<Rgba> is !null: Freeze, PhantomData<ArcInner<Rgba>>: Freeze,

§

impl Move for PickedFile

§

impl Send for PickedFile
where RawVecInner: Send, Arc<dyn AsRef<[u8]> + Send + Sync>: Send, Arc<Rgba>: Send,

§

impl Sync for PickedFile
where RawVecInner: Sync, Arc<dyn AsRef<[u8]> + Send + Sync>: Sync, Arc<Rgba>: Sync,

§

impl Unpin for PickedFile
where *const u8 is !null: Unpin, Arc<dyn AsRef<[u8]> + Send + Sync>: Unpin, Arc<Rgba>: Unpin,

§

impl UnsafeUnpin for PickedFile
where *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const ArcInner<dyn AsRef<[u8]> + Send + Sync> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn AsRef<[u8]> + Send + Sync>>: UnsafeUnpin, *const ArcInner<Rgba> is !null: UnsafeUnpin, PhantomData<ArcInner<Rgba>>: UnsafeUnpin,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.