mtp_rs/lib.rs
1//! # mtp-rs
2//!
3//! A pure-Rust MTP (Media Transfer Protocol) library targeting modern Android devices.
4//!
5//! ## Features
6//!
7//! - **Runtime agnostic**: Uses `futures` traits, works with any async runtime
8//! - **Two-level API**: High-level `mtp::` for media devices, low-level `ptp::` for cameras
9//! - **Streaming**: Memory-efficient streaming downloads with progress tracking
10//! - **Type safe**: Newtype wrappers prevent mixing up IDs
11//!
12//! ## Quick start
13//!
14//! ```rust,ignore
15//! use mtp_rs::mtp::MtpDevice;
16//!
17//! # async fn example() -> Result<(), mtp_rs::Error> {
18//! // Open the first MTP device
19//! let device = MtpDevice::open_first().await?;
20//!
21//! println!("Connected to: {} {}",
22//! device.device_info().manufacturer,
23//! device.device_info().model);
24//!
25//! // Get storages
26//! for storage in device.storages().await? {
27//! println!("Storage: {} ({} free)",
28//! storage.info().description,
29//! storage.info().free_space_bytes);
30//!
31//! // List root folder
32//! for obj in storage.list_objects(None).await? {
33//! let kind = if obj.is_folder() { "DIR " } else { "FILE" };
34//! println!(" {} {} ({} bytes)", kind, obj.filename, obj.size);
35//! }
36//! }
37//! # Ok(())
38//! # }
39//! ```
40
41pub mod error;
42pub mod mtp;
43pub mod ptp;
44pub mod transport;
45
46pub use error::Error;
47
48// Re-export core types for convenience
49pub use ptp::{
50 receive_stream_to_stream, DateTime, EventCode, ObjectFormatCode, ObjectHandle, OperationCode,
51 ReceiveStream, ResponseCode, SessionId, StorageId, TransactionId,
52};
53
54// Re-export high-level MTP types
55pub use mtp::{
56 DeviceEvent, FileDownload, MtpDevice, MtpDeviceBuilder, NewObjectInfo, ObjectListing, Progress,
57 Storage,
58};