Struct Device
pub struct Device {
file: File,
geometry: Geometry,
}Expand description
Open MTD character device.
Access its blocks through Flash.
Fields§
§file: File§geometry: GeometryImplementations§
§impl Device
impl Device
pub fn open(path: &Path) -> Result<Self, DeviceError>
pub fn open(path: &Path) -> Result<Self, DeviceError>
Opens the MTD character device at path for reading and writing.
§Errors
Returns an error if the device can’t be opened or reports a geometry this crate can’t handle.
pub fn open_read_only(path: &Path) -> Result<Self, DeviceError>
pub fn open_read_only(path: &Path) -> Result<Self, DeviceError>
Opens the MTD character device at path for reading only.
§Errors
Returns an error if the device can’t be opened or reports a geometry this crate can’t handle.
fn open_with(path: &Path, write: bool) -> Result<Self, DeviceError>
Trait Implementations§
§impl Flash for Device
impl Flash for Device
§fn is_bad(&self, block: u32) -> Result<bool, DeviceError>
fn is_bad(&self, block: u32) -> Result<bool, DeviceError>
Returns whether
block has a bad block marker. Read more§fn mark_bad(&self, block: u32) -> Result<(), DeviceError>
fn mark_bad(&self, block: u32) -> Result<(), DeviceError>
Writes a bad block marker to
block. Read more§fn read_unchecked(
&self,
block: u32,
offset: u32,
buf: &mut [u8],
) -> Result<(), DeviceError>
fn read_unchecked( &self, block: u32, offset: u32, buf: &mut [u8], ) -> Result<(), DeviceError>
Reads like
Flash::read, but doesn’t check for ECC errors. Read moreimpl Sealed for Device
Auto Trait Implementations§
impl Freeze for Device
impl RefUnwindSafe for Device
impl Send for Device
impl Sync for Device
impl Unpin for Device
impl UnsafeUnpin for Device
impl UnwindSafe for Device
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