From 52959d62046bc02c6995599b3540a222bdc19231 Mon Sep 17 00:00:00 2001 From: "Christopher N. Hesse" Date: Sat, 28 Oct 2023 15:12:32 +0200 Subject: [PATCH] Fix doc tests Signed-off-by: Christopher N. Hesse --- eye-hal/src/lib.rs | 2 +- eye-hal/src/platform/mod.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/eye-hal/src/lib.rs b/eye-hal/src/lib.rs index 2e200d7..6731bd6 100644 --- a/eye-hal/src/lib.rs +++ b/eye-hal/src/lib.rs @@ -44,7 +44,7 @@ //! //! // First, we need a capture device to read images from. For this example, let's just choose //! // whatever device is first in the list. -//! let dev = ctx.open_device(&devices[0]).expect("Failed to open video device"); +//! let dev = ctx.open_device(&devices[0].uri).expect("Failed to open video device"); //! //! // Query for available streams and just choose the first one. //! let streams = dev.streams().expect("Failed to query streams"); diff --git a/eye-hal/src/platform/mod.rs b/eye-hal/src/platform/mod.rs index 8ac880d..fa6abf7 100644 --- a/eye-hal/src/platform/mod.rs +++ b/eye-hal/src/platform/mod.rs @@ -52,6 +52,14 @@ impl<'a> Context<'a> { } } +impl<'a> Default for Context<'a> { + fn default() -> Self { + Self::all() + .next() + .expect("no contexts available for this platform") + } +} + impl<'a> ContextTrait<'a> for Context<'a> { type Device = Device<'a>;