use super::{ReadExt, Version}; #[derive(Debug)] pub enum Index { WithoutPathHash(IndexV1), WithPathHash, } impl Index { pub fn new(reader: &mut R, version: &Version) -> Result { Ok(match version < &Version::PathHashIndex { true => Index::WithoutPathHash(IndexV1::new(reader, version)?), false => Index::WithPathHash, }) } } #[derive(Debug)] pub struct IndexV1 { pub mount_point: String, pub entries: Vec, } impl IndexV1 { pub fn new( reader: &mut R, version: &super::Version, ) -> Result { Ok(Self { mount_point: reader.read_string()?, entries: reader.read_array(|reader| super::Entry::new(reader, version))?, }) } } pub struct IndexV2 {}