Folder

Struct Folder 

Source
pub struct Folder<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Folder<'a>

Source

pub fn parent_id(&self) -> u32

Source

pub fn name(&self) -> &str

Source

pub fn sibling(&self) -> Option<Folder<'a>>

Source

pub fn child(&self) -> Option<Folder<'a>>

Source

pub fn find(&self, folder_id: u32) -> Option<Folder<'a>>

Source

pub fn rename(&mut self, new_name: &str) -> Result<()>

Trait Implementations§

Source§

impl Debug for Folder<'_>

Source§

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

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

impl Drop for Folder<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Object for &Folder<'_>

Source§

fn id(&self) -> u32

Must return the id of the object.
Source§

fn device(&self) -> &MtpDevice

Must return a valid reference of an MtpDevice, where this object resides in.
Source§

fn get_string(&self, property: Property) -> Result<String>

Retrieves a string from an object attribute.
Source§

fn set_string(&self, property: Property, string: &str) -> Result<()>

Sets an object attribute from a string.
Source§

fn get_u64(&self, property: Property) -> Result<u64>

Retrieves an u64 from an object attribute.
Source§

fn get_u32(&self, property: Property) -> Result<u32>

Retrieves an u32 from an object attribute, returns the value of default on failure.
Source§

fn set_u32(&self, property: Property, value: u32) -> Result<()>

Sets an object attribute from an u32.
Source§

fn get_u16(&self, property: Property) -> Result<u16>

Retrieves an u16 from an object attribute, returns the value of default on failure.
Source§

fn set_u16(&self, property: Property, value: u16) -> Result<()>

Sets an object attribute from an u16.
Source§

fn get_u8(&self, property: Property) -> Result<u8>

Retrieves an u8 from an object attribute, returns the value of default on failure.
Source§

fn set_u8(&self, property: Property, value: u8) -> Result<()>

Sets an object attribute from an u8.
Source§

fn delete(&self) -> Result<()>

Deletes a single file, track, playlist, folder or any other object off the MTP device. Note that deleting folders may no be remove its contents, in turn this is the expected behavior. Read more
Source§

fn move_to(&self, storage_id: u32, parent: Parent) -> Result<()>

Moves the object to the specified storage (by its id) and parent folder. Moving objects may or not be supported on the device. Read more
Source§

fn copy_to(&self, storage_id: u32, parent: Parent) -> Result<()>

Copies the object to the specified storage (by its id) and parent folder. Copying objects may or not be supported on the device. Read more
Source§

fn get_partial_object(&self, offset: u64, maxbytes: u32) -> Result<Vec<u8>>

Get partial data from an object, specifying an offset and the maximum bytes that should be read. Note that this may return fewer bytes than the maximum.
Source§

fn send_partial_object(&self, offset: u64, data: impl AsRef<[u8]>) -> Result<()>

Send partial data to an object, specifying an offset and the data you want to write into the object.
Source§

impl Object for Folder<'_>

Source§

fn id(&self) -> u32

Must return the id of the object.
Source§

fn device(&self) -> &MtpDevice

Must return a valid reference of an MtpDevice, where this object resides in.
Source§

fn get_string(&self, property: Property) -> Result<String>

Retrieves a string from an object attribute.
Source§

fn set_string(&self, property: Property, string: &str) -> Result<()>

Sets an object attribute from a string.
Source§

fn get_u64(&self, property: Property) -> Result<u64>

Retrieves an u64 from an object attribute.
Source§

fn get_u32(&self, property: Property) -> Result<u32>

Retrieves an u32 from an object attribute, returns the value of default on failure.
Source§

fn set_u32(&self, property: Property, value: u32) -> Result<()>

Sets an object attribute from an u32.
Source§

fn get_u16(&self, property: Property) -> Result<u16>

Retrieves an u16 from an object attribute, returns the value of default on failure.
Source§

fn set_u16(&self, property: Property, value: u16) -> Result<()>

Sets an object attribute from an u16.
Source§

fn get_u8(&self, property: Property) -> Result<u8>

Retrieves an u8 from an object attribute, returns the value of default on failure.
Source§

fn set_u8(&self, property: Property, value: u8) -> Result<()>

Sets an object attribute from an u8.
Source§

fn delete(&self) -> Result<()>

Deletes a single file, track, playlist, folder or any other object off the MTP device. Note that deleting folders may no be remove its contents, in turn this is the expected behavior. Read more
Source§

fn move_to(&self, storage_id: u32, parent: Parent) -> Result<()>

Moves the object to the specified storage (by its id) and parent folder. Moving objects may or not be supported on the device. Read more
Source§

fn copy_to(&self, storage_id: u32, parent: Parent) -> Result<()>

Copies the object to the specified storage (by its id) and parent folder. Copying objects may or not be supported on the device. Read more
Source§

fn get_partial_object(&self, offset: u64, maxbytes: u32) -> Result<Vec<u8>>

Get partial data from an object, specifying an offset and the maximum bytes that should be read. Note that this may return fewer bytes than the maximum.
Source§

fn send_partial_object(&self, offset: u64, data: impl AsRef<[u8]>) -> Result<()>

Send partial data to an object, specifying an offset and the data you want to write into the object.

Auto Trait Implementations§

§

impl<'a> Freeze for Folder<'a>

§

impl<'a> RefUnwindSafe for Folder<'a>

§

impl<'a> !Send for Folder<'a>

§

impl<'a> !Sync for Folder<'a>

§

impl<'a> Unpin for Folder<'a>

§

impl<'a> UnwindSafe for Folder<'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> AsObjectId for T
where T: Object,

Source§

fn as_id(&self) -> u32

Treat the implementor as an object id.
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.