Skip to main content

Camera

Struct Camera 

Source
pub struct Camera<R: VmbRuntime> { /* private fields */ }
Expand description

Open handle to a Vimba camera.

Dropping the camera cleanly ends any running capture (via Camera::stop_capture) and closes the adapter-side resources.

Implementations§

Source§

impl<R: VmbRuntime> Camera<R>

Source

pub fn open(runtime: Arc<R>, id: &str) -> Result<Self>

Open a camera by its transport-layer ID. Usually called via VmbSystem::open_camera.

Source

pub fn id(&self) -> &str

The camera ID originally passed to Camera::open.

Source

pub fn load_settings(&self, path: &Path) -> Result<()>

Load a Vimba settings XML (day/night profile).

Source

pub fn start_capture<F>( &mut self, num_buffers: usize, callback: F, ) -> Result<()>
where F: for<'a> Fn(&Frame<'a>) + Send + Sync + 'static,

Start continuous capture.

The closure is invoked for every received frame; it MUST be fast and immediately copy the frame bytes (the adapter re-queues the buffer as soon as the callback returns). The closure may run on any thread the adapter chooses and must be Send + Sync.

num_buffers is the number of frame buffers to pre-announce; 4 is a reasonable default.

§Cleanup contract

All resources claimed between the first announce_frame and the final Ok(()) are unwound on any error path before returning. This guarantees self.session is only populated when the adapter is fully primed — preventing a latent use-after-free where the SDK could otherwise hold pointers into callback allocations that get dropped when Camera::drop skips stop_capture.

Source

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

Stop an in-progress capture. Safe to call when no capture is running — the call is a no-op in that case.

Trait Implementations§

Source§

impl<R: VmbRuntime> Debug for Camera<R>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<R: VmbRuntime> Drop for Camera<R>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<R> Freeze for Camera<R>

§

impl<R> RefUnwindSafe for Camera<R>
where R: RefUnwindSafe,

§

impl<R> Send for Camera<R>

§

impl<R> Sync for Camera<R>

§

impl<R> Unpin for Camera<R>

§

impl<R> UnsafeUnpin for Camera<R>

§

impl<R> UnwindSafe for Camera<R>
where R: RefUnwindSafe,

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.