Add viewer navigation and file downloads
This commit is contained in:
parent
490c925f62
commit
ef2a0a7915
3 changed files with 221 additions and 43 deletions
|
|
@ -15,6 +15,10 @@ impl EntryKind {
|
|||
pub fn is_viewable(self) -> bool {
|
||||
matches!(self, Self::ZipArchive | Self::Image | Self::Video)
|
||||
}
|
||||
|
||||
pub fn is_media(self) -> bool {
|
||||
matches!(self, Self::Image | Self::Video)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
@ -194,6 +198,10 @@ mod tests {
|
|||
assert_eq!(classify_file(Path::new("movie.MP4")), EntryKind::Video);
|
||||
assert_eq!(classify_file(Path::new("movie.mkv")), EntryKind::Video);
|
||||
assert_eq!(classify_file(Path::new("notes.txt")), EntryKind::OtherFile);
|
||||
assert!(EntryKind::Image.is_media());
|
||||
assert!(EntryKind::Video.is_media());
|
||||
assert!(!EntryKind::ZipArchive.is_media());
|
||||
assert!(!EntryKind::OtherFile.is_media());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue