MCPcopy Create free account
hub / github.com/RustCV/RustCV / CameraError

Enum CameraError

rustcv-camera/src/error.rs:13–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11/// 本 crate 可能返回的所有错误类型。
12#[derive(Debug, thiserror::Error)]
13pub enum CameraError {
14 /// The specified camera device was not found.
15 /// 指定的摄像头设备未找到。
16 #[error("device not found: {0}")]
17 DeviceNotFound(String),
18
19 /// The device is already in use by another process.
20 /// 设备已被其他进程占用。
21 #[error("device busy")]
22 DeviceBusy,
23
24 /// The requested pixel format is not supported by the device.
25 /// 设备不支持请求的像素格式。
26 #[error("format not supported")]
27 FormatNotSupported,
28
29 /// The requested resolution is not supported by the device.
30 /// 设备不支持请求的分辨率。
31 #[error("resolution not supported: {0}x{1}")]
32 ResolutionNotSupported(u32, u32),
33
34 /// Attempted to capture frames without starting the stream first.
35 /// 在未启动流的情况下尝试取帧。
36 #[error("stream not started")]
37 StreamNotStarted,
38
39 /// Failed to allocate kernel mmap buffers.
40 /// 内核 mmap 缓冲区分配失败。
41 #[error("buffer allocation failed")]
42 BufferAllocationFailed,
43
44 /// Error during pixel format decoding (MJPEG, YUYV, etc.).
45 /// 像素格式解码(MJPEG、YUYV 等)时出错。
46 #[error("decode error: {0}")]
47 DecodeError(String),
48
49 /// Underlying OS I/O error.
50 /// 底层操作系统 I/O 错误。
51 ///
52 /// The `#[from]` attribute auto-implements `From<io::Error>`,
53 /// so the `?` operator converts `io::Error` automatically.
54 /// `#[from]` 自动实现 `From<io::Error>`,使 `?` 运算符能自动转换。
55 #[error("io error: {0}")]
56 Io(#[from] io::Error),
57}
58
59/// A type alias for `Result<T, CameraError>`.
60/// `Result<T, CameraError>` 的类型别名。

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected