Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrosland committed Mar 26, 2018
1 parent 352ea14 commit 6891285
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

//use cv::*;
// use futures::Future;
extern crate cam;
Expand Down Expand Up @@ -97,7 +99,7 @@ fn serious(info: &CameraInfo) {
// Benchmarking from https://github.com/seenaburns/raytracer/blob/master/src/bench.rs

// Run function and return result with seconds duration
pub fn time<F, T>(f: F) -> (T, f64)
fn time<F, T>(f: F) -> (T, f64)
where
F: FnOnce() -> T,
{
Expand All @@ -111,7 +113,7 @@ where
}

// Prints iteration execution time and average
pub fn bench_jpegs_per_sec(n: i32) {
fn bench_jpegs_per_sec(n: i32) {
let mut runs: Vec<f64> = Vec::with_capacity(n as usize);

let info = info().unwrap();
Expand Down Expand Up @@ -140,7 +142,7 @@ pub fn bench_jpegs_per_sec(n: i32) {
);
}

pub fn bench_jpegs(n: i32, camera: &mut Box<SimpleCamera>) {
fn bench_jpegs(n: i32, camera: &mut Box<SimpleCamera>) {
for _ in 0..n {
camera.take_one().unwrap();
}
Expand Down
11 changes: 8 additions & 3 deletions src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ use std::os::raw::c_uint;
/// Settings for the camera.
///
/// ```
/// # use cam::{CameraError, CameraSettings, SimpleCamera};
/// #
/// # let info = cam::info().unwrap().cameras[0].clone();
/// # let mut camera = SimpleCamera::new(info.clone()).unwrap();
/// #
/// let settings = CameraSettings{
/// width: self.info.max_width,
/// height: self.info.max_height,
/// width: info.max_width,
/// height: info.max_height,
/// ..CameraSettings::default()
/// };
/// camera.set_camera_format(&settings)?;
/// camera.configure(settings);
/// ```
pub struct CameraSettings {
pub encoding: c_uint,
Expand Down

0 comments on commit 6891285

Please sign in to comment.