Skip to main content

CameraDevice

Trait CameraDevice 

Source
pub trait CameraDevice {
    // Required methods
    fn supports_partial_reads(&self) -> bool;
    fn storage_ids(&mut self) -> Result<Vec<u32>, CameraError>;
    fn object_handles(&mut self, storage: u32) -> Result<Vec<u32>, CameraError>;
    fn object(&mut self, handle: u32) -> Result<CameraObject, CameraError>;
    fn read_object(
        &mut self,
        object: &CameraObject,
        offset: u64,
        sink: &mut dyn Write,
    ) -> Result<u64, CameraError>;
}
Expand description

The camera the adapter reads from. Read-only by construction: enumeration and reads only.

Required Methods§

Source

fn supports_partial_reads(&self) -> bool

Whether read_object accepts a non-zero offset.

Source

fn storage_ids(&mut self) -> Result<Vec<u32>, CameraError>

The storages present.

Source

fn object_handles(&mut self, storage: u32) -> Result<Vec<u32>, CameraError>

Every object handle on storage, folders included, at any depth.

Source

fn object(&mut self, handle: u32) -> Result<CameraObject, CameraError>

One object’s record.

Source

fn read_object( &mut self, object: &CameraObject, offset: u64, sink: &mut dyn Write, ) -> Result<u64, CameraError>

Stream object’s bytes from offset to its end into sink; returns the bytes written. A non-zero offset is only asked of a device that supports partial reads, for an object of known size.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<C: Read + Write, E: Read + Write> CameraDevice for PtpCamera<C, E>