Skip to main content

nokhwa/
lib.rs

1#![deny(clippy::pedantic)]
2#![warn(clippy::all)]
3#![allow(clippy::module_name_repetitions)]
4/*
5 * Copyright 2022 l1npengtul <l1npengtul@protonmail.com> / The Nokhwa Contributors
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *     http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19#![cfg_attr(feature = "docs-features", feature(doc_cfg))]
20//! # nokhwa
21//! A Simple-to-use, cross-platform Rust Webcam Capture Library
22//!
23//! The raw backends can be found in [`backends`](crate::backends)
24//!
25//! The [`Camera`] struct is what you will likely use.
26//!
27//! The recommended default feature to enable is `input-native`. The library will not work without
28//! at least one `input-*` feature enabled.
29//!
30//! Please read the README.md for more.
31
32/// Raw access to each of Nokhwa's backends.
33pub mod backends;
34mod camera;
35mod init;
36// /// A camera that uses native browser APIs meant for WASM applications.
37// #[cfg(feature = "input-jscam")]
38// #[cfg_attr(feature = "docs-features", doc(cfg(feature = "input-jscam")))]
39// pub mod js_camera;
40
41pub use nokhwa_core::pixel_format::FormatDecoder;
42mod query;
43/// A camera that runs in a different thread and can call your code based on callbacks.
44#[cfg(feature = "output-threaded")]
45#[cfg_attr(feature = "docs-features", doc(cfg(feature = "output-threaded")))]
46pub mod threaded;
47
48pub use camera::Camera;
49pub use init::*;
50pub use nokhwa_core::buffer::Buffer;
51pub use nokhwa_core::error::NokhwaError;
52pub use query::*;
53#[cfg(feature = "output-threaded")]
54#[cfg_attr(feature = "docs-features", doc(cfg(feature = "output-threaded")))]
55pub use threaded::CallbackCamera;
56
57pub mod utils {
58    pub use nokhwa_core::types::*;
59}
60
61pub mod error {
62    pub use nokhwa_core::error::NokhwaError;
63}
64
65pub mod camera_traits {
66    pub use nokhwa_core::traits::*;
67}
68
69pub mod pixel_format {
70    pub use nokhwa_core::pixel_format::*;
71}
72
73pub mod buffer {
74    pub use nokhwa_core::buffer::*;
75}