feat(meta): LazyBin & LazyObject#149
Conversation
66d6689 to
251edbe
Compare
5574d62 to
b817943
Compare
b817943 to
fdb2b7e
Compare
fdb2b7e to
854bee4
Compare
| is_override: bool, | ||
| objects: Vec<BinObject<M>>, | ||
| dependencies: Vec<String>, | ||
| dependencies: Vec<PrefixString<u16>>, |
There was a problem hiding this comment.
I'm not sure whether this is worth the change, might be better to just leave it as is imo, we can have a sanity check when writing.
This also breaks the public API for anybody accessing .dependencies
| // Always write version 3 | ||
| writer.write_u32::<LE>(WRITE_VERSION)?; | ||
| writer.write_u32::<LE>(self.dependencies.len() as _)?; | ||
| writer.write_u32::<LE>(self.version)?; |
There was a problem hiding this comment.
We should keep version hardcoded to 3, don't think we gain anything by not
| writer.write_u32::<LE>(WRITE_VERSION)?; | ||
| writer.write_u32::<LE>(self.dependencies.len() as _)?; | ||
| writer.write_u32::<LE>(self.version)?; | ||
| writer.write_u32::<LE>(self.dependencies.len().try_into().unwrap())?; |
There was a problem hiding this comment.
Related to comment above, this breaks the file when you write version 1 e2e for example.
| /// ``` | ||
| pub fn to_writer<W: io::Write + io::Seek + ?Sized>(&self, writer: &mut W) -> io::Result<()> { | ||
| match self.is_override { | ||
| true => todo!("implement is_override Bin write"), |
There was a problem hiding this comment.
Should probably leave in the todo! panic as the changes in this PR make the writer output broken files.
if self.is_override {
writer.write_u32::<LE>(self.data_overrides.len() as _)?;
// TODO: impl data overrides
//for o in &self.data_overrides {
//}
}
^ not correct since you always write PropHeader::MAGIC
| }) | ||
| } | ||
|
|
||
| pub fn object(self, path: impl Into<BinHash>) -> Result<Option<LazyObject<'r, R>>, ReadErr> { |
There was a problem hiding this comment.
Instead of consuming self here for no reason, we should be able to have it as &mut self.
Right now you need to re-parse the header for each object you want to fetch lazily.
Fixable if we keep a lookup table of all entries offset and size, that way you can easily hop around the stream to the entry you need.
No description provided.