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