Skip to main content

vmb_core/
lib.rs

1//! Runtime-agnostic domain types and ports for `vmb-rs`.
2//!
3//! This crate contains:
4//!
5//! * [`VmbError`] + [`Result`] — the error type of every port method and
6//!   every domain operation.
7//! * [`Frame`] + [`PixelFormat`] — the safe, borrowed view of a received
8//!   frame handed to user callbacks.
9//! * [`CameraInfo`] + [`DiscoveryEvent`] — domain value types.
10//! * Opaque handle newtypes ([`CameraHandle`], [`FrameSlotId`], etc.) —
11//!   identifiers the domain uses to refer to adapter-owned resources
12//!   without leaking FFI pointer types.
13//! * [`FrameCallback`] — the erased user closure struct delivered via
14//!   a per-camera registry.
15//!
16//! `vmb-core` has no `unsafe` blocks and no dependency on `vmb-sys`. The
17//! companion `vmb-ffi` crate hosts the adapter that links against
18//! `libVmbC`; `vmb-fake` hosts a pure-Rust adapter used for unit tests.
19
20#![forbid(unsafe_code)]
21
22pub mod callback;
23pub mod camera;
24pub mod discovery;
25pub mod error;
26pub mod frame;
27pub mod port;
28pub mod system;
29pub mod types;
30
31pub use callback::FrameCallback;
32pub use camera::Camera;
33pub use discovery::{register_camera_discovery, DiscoveryRegistration};
34pub use error::{check, error_name, VmbError};
35pub use frame::{Frame, PixelFormat};
36pub use port::{DiscoveryCallback, VmbRuntime};
37pub use system::VmbSystem;
38pub use types::{
39    CameraHandle, CameraInfo, DiscoveryCallbackId, DiscoveryEvent, DiscoveryRegistrationHandle,
40    FrameCallbackId, FrameSlotId,
41};
42
43/// Convenience alias: `Result<T, VmbError>`.
44pub type Result<T> = std::result::Result<T, VmbError>;