Skip to main content

NusbTransfer

Struct NusbTransfer 

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

UsbTransfer over a USB3 Vision device opened with nusb: its control interface claimed, and its streaming and event interfaces when it has them.

A streaming or event interface that cannot be claimed does not stop the camera from opening — its features still work — but opening a stream or events on it returns the claim’s error (backlog UV-03: it used to be discarded).

Implementations§

Source§

impl NusbTransfer

Source

pub fn open(info: &U3vDeviceInfo) -> Result<Self, U3vError>

Open the device enumeration reported as info and claim its USB3 Vision interfaces: control, and streaming and events where it has them. U3vDevice::open_device opens one this way.

Source

pub fn interfaces(&self) -> &U3vInterfaceInfo

The device’s USB3 Vision interfaces and endpoints.

Trait Implementations§

Source§

impl UsbTransfer for NusbTransfer

Source§

fn bulk_write( &self, endpoint: u8, data: &[u8], timeout: Duration, ) -> Result<usize, U3vError>

Write data to the bulk OUT endpoint. Returns bytes written.
Source§

fn bulk_read( &self, endpoint: u8, buf: &mut [u8], timeout: Duration, ) -> Result<usize, U3vError>

Read up to buf.len() bytes from the bulk IN endpoint. Returns the number of bytes actually read.
Source§

fn bulk_in(self: &Arc<Self>, endpoint: u8) -> Result<Box<dyn BulkIn>, U3vError>

Reads on the bulk IN endpoint that can be queued ahead of the device, as a stream needs them. Read more
Source§

fn max_packet_size(&self, endpoint: u8) -> Option<usize>

The largest packet the endpoint carries, from its descriptor; None when unknown. Every IN transfer a stream asks for is a multiple of it, so that a packet never straddles two transfers.
The speed the host’s USB stack reports the device runs at; None when this transport cannot tell.
Source§

fn is_present(&self) -> Option<bool>

Whether the operating system still lists the device, asked after a transfer failed in a way that does not say whether it is gone; None when this transport cannot tell. One look, no waiting.

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more