FlipperStorage

Struct FlipperStorage 

Source
pub struct FlipperStorage { /* private fields */ }
Expand description

Interface to Flipper device storage.

Implementations§

Source§

impl FlipperStorage

Source

pub fn new(port: Box<dyn SerialPort>) -> Self

Create new FlipperStorage connected to a SerialPort.

Source

pub fn start(&mut self) -> Result<()>

Start serial interface.

Source

pub fn port(&self) -> &dyn SerialPort

Get reference to underlying SerialPort.

Source

pub fn port_mut(&mut self) -> &mut dyn SerialPort

Get mutable reference to underlying SerialPort.

Source

pub fn cli_mut(&mut self) -> &mut SerialCli

Get mutable reference to underlying SerialCli.

Source

pub fn list_tree(&mut self, path: &FlipperPath) -> Result<()>

List files and directories on the device.

Source

pub fn send_file( &mut self, from: impl AsRef<Path>, to: &FlipperPath, ) -> Result<()>

Send local file to the device.

Source

pub fn receive_file( &mut self, from: &FlipperPath, to: impl AsRef<Path>, ) -> Result<()>

Receive remote file from the device.

Source

pub fn read_file(&mut self, path: &FlipperPath) -> Result<BytesMut>

Read file data from the device.

Source

pub fn exist(&mut self, path: &FlipperPath) -> Result<bool>

Does the file or directory exist on the device?

Source

pub fn exist_dir(&mut self, path: &FlipperPath) -> Result<bool>

Does the directory exist on the device?

Source

pub fn exist_file(&mut self, path: &FlipperPath) -> Result<bool>

Does the file exist on the device?

Source

pub fn size(&mut self, path: &FlipperPath) -> Result<usize>

File size in bytes

Source

pub fn mkdir(&mut self, path: &FlipperPath) -> Result<()>

Make directory on the device.

Source

pub fn format_ext(&mut self) -> Result<()>

Format external storage.

Source

pub fn remove(&mut self, path: &FlipperPath) -> Result<()>

Remove file or directory.

Source

pub fn md5sum(&mut self, path: &FlipperPath) -> Result<String>

Calculate MD5 hash of file.

Auto Trait Implementations§

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> 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.