wxtla/images/qcow/
driver.rs1use super::{DESCRIPTOR, image::QcowImage};
4use crate::{ByteSourceHandle, DataSource, Driver, OpenOptions, Result};
5
6#[derive(Debug, Default, Clone, Copy)]
8pub struct QcowDriver;
9
10impl QcowDriver {
11 pub const fn new() -> Self {
13 Self
14 }
15
16 pub fn open(source: ByteSourceHandle) -> Result<QcowImage> {
18 QcowImage::open(source)
19 }
20}
21
22impl Driver for QcowDriver {
23 fn descriptor(&self) -> crate::FormatDescriptor {
24 DESCRIPTOR
25 }
26
27 fn open(
28 &self, source: ByteSourceHandle, options: OpenOptions<'_>,
29 ) -> Result<Box<dyn DataSource>> {
30 Ok(Box::new(QcowImage::open_with_hints(source, options.hints)?))
31 }
32}