From 179920fa402b81a3ae8cc3c4b415172f71eb8d11 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Fri, 7 Jul 2023 00:26:54 +0200 Subject: add gui --- src/index.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/index.rs') diff --git a/src/index.rs b/src/index.rs index 616682d..9f0af1d 100644 --- a/src/index.rs +++ b/src/index.rs @@ -1,3 +1,4 @@ +use std::fmt::{Formatter, Debug, Result}; use std::fs::File; use std::io::{Write, BufReader, BufRead}; use walkdir::*; @@ -14,12 +15,26 @@ use crate::vector; /// Represents a Index which is ether generated /// or read from a file. +#[derive(Clone, Debug)] pub struct Index { dictionary : Dictionary, filecache : Vec, } +impl Default for Index { + fn default() -> Self { + Self::empty() + } +} + impl Index { + pub fn empty() -> Self { + Self { + dictionary : Dictionary::new(), + filecache : Vec::new() + } + } + pub fn generate(input_path : &str, index_path : &str, callback : impl Fn(u64, u64)) -> Self { let mut index_file = File::create(index_path).unwrap(); let mut dict = Dictionary::new(); -- cgit v1.2.3-70-g09d2