use super::EntryBuilderCore;
use crate::{
Metadata, NormalEntry,
chunk::RawChunk,
entry::{EntryHeader, EntryName},
};
use std::io;
pub struct DirEntryBuilder {
core: EntryBuilderCore,
}
impl DirEntryBuilder {
#[inline]
pub const fn new(name: EntryName) -> Self {
Self {
core: EntryBuilderCore::new(EntryHeader::for_dir(name)),
}
}
#[inline]
pub fn metadata(&mut self, metadata: Metadata) -> &mut Self {
self.core.metadata(metadata);
self
}
#[inline]
pub fn add_extra_chunk<T: Into<RawChunk>>(&mut self, chunk: T) -> &mut Self {
self.core.add_extra_chunk(chunk);
self
}
#[inline]
#[must_use = "building an entry without using it is wasteful"]
pub fn build(self) -> io::Result<NormalEntry> {
Ok(self.core.build(Vec::new(), None))
}
}