Expand description
A memory safe API for interacting with libmtp library.
§Install
To install the latest version of the crate from crates.io, run:
$ cargo add libmtp§Getting started
To get started, create a new program that prints all objects in the root folder of your storage:
use libmtp::RawDevice;
use libmtp::search_raw_devices;
fn main() -> libmtp::Result<()> {
for device in search_raw_devices()?.filter_map(RawDevice::open_uncached) {
for storage in &device {
for object in &storage {
println!("{object:?}");
}
}
}
Ok(())
}For more examples, see examples.
§Changelog
For a release history, see CHANGELOG.md.
§Contributing
For a contibuting guide, see CONTRIBUTING.md.
§License
This crate is distributed under the terms of MIT License.
See LICENSE for details.
Structs§
- Battery
- The battery of the device.
- Device
- An opened device connected via USB.
- Error
- Specialized Error type used within the crate.
- File
- A file on the storage.
- Folder
- A folder on the storage.
- Object
Iter - An iterator over the objects of the folder.
- Object
Recursive Iter - A recursive iterator over the objects of the folder.
- Product
- A product of the device.
- RawDevice
- A device connected via USB, but not yet opened.
- RawDevice
Iter - An iterator over the raw devices.
- Storage
- A storage of the device.
- Storage
Iter - An iterator over the storages of the device.
- Vendor
- A vendor of the device.
Enums§
- Error
Kind - Category for an error used within the crate.
- File
Kind - The kind of the file.
- Filesystem
- A filesystem of the storage.
- MtpError
Kind - Category for an error, that occured at the MTP (Media Transfer Protocol) layer.
- Object
- A file or a folder on the storage.
- Storage
Access - An access capability over the storage.
- Storage
Kind - A kind of the storage.
Functions§
- search_
raw_ devices - Searches the devices connected via USB, but not yet opened.
Type Aliases§
- Result
- Specialized Result type used within the crate.