use crate::{Content, ContentPath, ContentType};
use std::path::Path;
pub struct FolderContent<T: ContentType> {
path: ContentPath,
content_type: T,
}
impl<T: ContentType> FolderContent<T> {
pub fn with_content_type(path: impl AsRef<Path>, content_type: T) -> Self {
Self {
path: ContentPath::from_os(path.as_ref()),
content_type,
}
}
}
impl<T: ContentType> Content<T> for FolderContent<T> {
fn path(&self) -> &ContentPath {
&self.path
}
fn size(&self) -> u64 {
0
}
fn read(&mut self, _: u64, _: u32) -> Option<&[u8]> {
None
}
fn content_type(&self) -> Option<T> {
Some(self.content_type)
}
fn set_content_type(&mut self, ty: T) {
self.content_type = ty;
}
}