Struct Partition
pub struct Partition {
pub index: u32,
pub name: String,
pub size: u64,
pub erase_size: u64,
}Expand description
MTD partition listed in /proc/mtd.
Fields§
§index: u32Index of the MTD device, as in /dev/mtd<index>.
name: StringName of the partition.
size: u64Size of the partition in bytes.
erase_size: u64Erase block size in bytes.
Implementations§
§impl Partition
impl Partition
pub fn list() -> Result<Vec<Self>, DeviceError>
pub fn list() -> Result<Vec<Self>, DeviceError>
Returns all partitions listed in /proc/mtd.
§Errors
Returns an error if /proc/mtd can’t be read or contains a line that
isn’t a valid partition entry.
pub fn find(name: &str) -> Result<Self, DeviceError>
pub fn find(name: &str) -> Result<Self, DeviceError>
Returns the partition named name.
§Errors
Returns DeviceError::PartitionNotFound if no partition has the name,
or an error if /proc/mtd can’t be read.
pub fn device_path(&self) -> PathBuf
pub fn device_path(&self) -> PathBuf
Returns the path of the character device, /dev/mtd<index>.
pub fn open(&self) -> Result<Device, DeviceError>
pub fn open(&self) -> Result<Device, DeviceError>
pub fn open_read_only(&self) -> Result<Device, DeviceError>
pub fn open_read_only(&self) -> Result<Device, DeviceError>
Trait Implementations§
impl Eq for Partition
impl StructuralPartialEq for Partition
Auto Trait Implementations§
impl Freeze for Partition
impl RefUnwindSafe for Partition
impl Send for Partition
impl Sync for Partition
impl Unpin for Partition
impl UnsafeUnpin for Partition
impl UnwindSafe for Partition
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