Struct Handle

Source
pub struct Handle<T: UsbContext> { /* private fields */ }
Expand description

A handle to a calculator.

Implementations§

Source§

impl<T: UsbContext> Handle<T>

Source

pub fn new(device: DeviceHandle<T>) -> Result<Self>

Create a new handle to a USB device.

Source

pub fn is_cx_ii(&self) -> Result<bool>

Whether this device is a CX II, CAS or non-CAS.

Source

pub fn info(&self) -> Result<Info>

Source

pub fn screenshot(&self) -> Result<Image>

Take a screenshot.

Source

pub fn move_file(&self, src: &str, dest: &str) -> Result<()>

Move/rename a file.

Source

pub fn file_attr(&self, src: &str) -> Result<DirItem>

Get the attributes of a file or directory.

Source

pub fn copy_file(&self, src: &str, dest: &str) -> Result<()>

Copy a file.

Source

pub fn delete_file(&self, path: &str) -> Result<()>

Delete a file.

Source

pub fn read_file( &self, path: &str, buf: &mut [u8], progress: &mut dyn FnMut(usize), ) -> Result<usize>

Read a file. Returns the number of bytes read. You must pass a buffer large enough to read the entire file (or smaller if that’s all you care about).

Source

pub fn write_file( &self, path: &str, buf: &[u8], progress: &mut dyn FnMut(usize), ) -> Result<()>

Write a file.

Source

pub fn send_os(&self, buf: &[u8], progress: &mut dyn FnMut(usize)) -> Result<()>

Send an OS update.

Source

pub fn create_dir(&self, path: &str) -> Result<()>

Create a directory.

Source

pub fn delete_dir(&self, path: &str) -> Result<()>

Delete a directory.

Source

pub fn list_dir(&self, path: &str) -> Result<DirList>

Get the contents of a directory.

Trait Implementations§

Source§

impl<T: UsbContext> Drop for Handle<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T: UsbContext> TryFrom<DeviceHandle<T>> for Handle<T>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(device: DeviceHandle<T>) -> Result<Self>

Performs the conversion.
Source§

impl<T: UsbContext> Send for Handle<T>

Source§

impl<T: UsbContext> Sync for Handle<T>

Auto Trait Implementations§

§

impl<T> Freeze for Handle<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Handle<T>
where T: RefUnwindSafe,

§

impl<T> Unpin for Handle<T>
where T: Unpin,

§

impl<T> UnwindSafe for Handle<T>
where T: UnwindSafe,

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> SetParameter for T

Source§

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result
where T: Parameter<Self>,

Sets value as a parameter of self.
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.