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