embassy-usb

Crates

git

Versions

default

Flavors

Skip to main content

ObjectInfo

Struct ObjectInfo 

Source
pub struct ObjectInfo<'a> {
Show 19 fields pub storage_id: u32, pub object_format: u16, pub protection_status: u16, pub object_compressed_size: u32, pub thumb_format: u16, pub thumb_compressed_size: u32, pub thumb_pix_width: u32, pub thumb_pix_height: u32, pub image_pix_width: u32, pub image_pix_height: u32, pub image_bit_depth: u32, pub parent_object: u32, pub association_type: u16, pub association_desc: u32, pub sequence_number: u32, pub filename: &'a str, pub capture_date: &'a str, pub modification_date: &'a str, pub keywords: &'a str,
}
Expand description

MTP ObjectInfo dataset used by op::GET_OBJECT_INFO and op::SEND_OBJECT_INFO.

Fields§

§storage_id: u32

Storage ID containing this object.

§object_format: u16

Object format code (see format).

§protection_status: u16

Protection status (0 = none, 1 = read-only).

§object_compressed_size: u32

Size of the object in bytes (0xFFFF_FFFF if >= 4 GiB).

§thumb_format: u16

Thumbnail format (0 if no thumbnail).

§thumb_compressed_size: u32

Thumbnail compressed size in bytes.

§thumb_pix_width: u32

Thumbnail width in pixels.

§thumb_pix_height: u32

Thumbnail height in pixels.

§image_pix_width: u32

Image width in pixels.

§image_pix_height: u32

Image height in pixels.

§image_bit_depth: u32

Image bit depth.

§parent_object: u32

Parent association handle (0 = root).

§association_type: u16

Association type (see assoc).

§association_desc: u32

Association description.

§sequence_number: u32

Sequence number.

§filename: &'a str

File or folder name.

§capture_date: &'a str

Capture date string (YYYYMMDDThhmmss).

§modification_date: &'a str

Modification date string (YYYYMMDDThhmmss).

§keywords: &'a str

Keywords string.

Implementations§

Source§

impl<'a> ObjectInfo<'a>

Source

pub const fn file( storage_id: u32, parent_object: u32, object_format: u16, size: u32, filename: &'a str, ) -> Self

Creates an ObjectInfo for a file in storage_id under parent_object.

Source

pub const fn folder( storage_id: u32, parent_object: u32, filename: &'a str, ) -> Self

Creates an ObjectInfo for a folder (format::ASSOCIATION, assoc::GENERIC_FOLDER).

Source

pub fn write_to(&self, writer: &mut MtpWriter<'_>) -> Result<(), MtpError>

Serializes the ObjectInfo dataset using writer.

Source

pub fn encode(&self, buf: &mut [u8]) -> Result<usize, MtpError>

Serializes the ObjectInfo dataset into buf, returning the encoded byte length.

Source

pub fn decode(data: &[u8], filename_buf: &'a mut [u8]) -> Result<Self, MtpError>

Parses an ObjectInfo dataset received from the host (such as SendObjectInfo), decoding filename into filename_buf and skipping trailing metadata strings.

Trait Implementations§

Source§

impl<'a> Clone for ObjectInfo<'a>

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<'a> Copy for ObjectInfo<'a>

Source§

impl<'a> Debug for ObjectInfo<'a>

Source§

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

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

impl<'a> Default for ObjectInfo<'a>

Source§

fn default() -> Self

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

impl<'a> Eq for ObjectInfo<'a>

Source§

impl<'a> PartialEq for ObjectInfo<'a>

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<'a> StructuralPartialEq for ObjectInfo<'a>

Auto Trait Implementations§

§

impl<'a> Forget for ObjectInfo<'a>

§

impl<'a> Freeze for ObjectInfo<'a>

§

impl<'a> Move for ObjectInfo<'a>

§

impl<'a> RefUnwindSafe for ObjectInfo<'a>

§

impl<'a> Send for ObjectInfo<'a>

§

impl<'a> Sync for ObjectInfo<'a>

§

impl<'a> Unpin for ObjectInfo<'a>

§

impl<'a> UnsafeUnpin for ObjectInfo<'a>

§

impl<'a> UnwindSafe for ObjectInfo<'a>

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, 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.