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
impl ObjectListing
Sourcepub fn total(&self) -> usize
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.
Auto Trait Implementations§
impl Freeze for ObjectListing
impl !RefUnwindSafe for ObjectListing
impl Send for ObjectListing
impl Sync for ObjectListing
impl Unpin for ObjectListing
impl UnsafeUnpin for ObjectListing
impl !UnwindSafe for ObjectListing
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