Skip to main content

ObjectListing

Struct ObjectListing 

Source
pub struct ObjectListing { /* private fields */ }
Expand description

An in-progress directory listing that yields ObjectInfo items one at a time.

Created by Storage::list_objects_stream(). After GetObjectHandles completes, the total count is known immediately. Each call to next() fetches one GetObjectInfo from USB, so the consumer can report progress (e.g., “Loading files (42 of 500)…”) as items arrive.

§Important

The MTP session is busy while this listing is active. You must consume all items (or drop the listing) before calling other storage methods.

§Example

let mut listing = storage.list_objects_stream(None).await?;
println!("Loading {} files...", listing.total());

while let Some(result) = listing.next().await {
    let info = result?;
    println!("[{}/{}] {}", listing.fetched(), listing.total(), info.filename);
}

Implementations§

Source§

impl ObjectListing

Source

pub fn total(&self) -> usize

Total number of object handles returned by the device.

When a parent filter is active (e.g., Fuji devices that return all objects for root), some items may be skipped, so the actual yielded count can be lower.

Source

pub fn fetched(&self) -> usize

Number of handles processed so far (including filtered-out items).

Source

pub async fn next(&mut self) -> Option<Result<ObjectInfo, Error>>

Fetch the next object from the device.

Returns None when all handles have been processed. Items that don’t match the parent filter are silently skipped.

Auto Trait Implementations§

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.