Still not working.
This commit is contained in:
parent
550d4c1876
commit
a01fcbee68
|
@ -31,14 +31,14 @@ pub impl Squozen {
|
|||
}
|
||||
|
||||
/*
|
||||
pub fn iter(&mut self) -> StoredPath {
|
||||
FoundPath::new(&self);
|
||||
pub fn matches(&mut self, pattern: &[u8]) -> StoredPath {
|
||||
FoundPath::new(&self, pattern);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
pub struct StoredPath<'a> {
|
||||
source: Squozen,
|
||||
source: &'a Squozen,
|
||||
path: [char; libc::PATH_MAX],
|
||||
db: Bytes<Bufreader>,
|
||||
ch: u8,
|
||||
|
@ -47,7 +47,7 @@ pub struct StoredPath<'a> {
|
|||
}
|
||||
|
||||
pub impl<'a> StoredPath {
|
||||
pub fn new(squozen: Squozen) -> StoredPath {
|
||||
pub fn new(squozen: &'a mut Squozen) -> StoredPath {
|
||||
let mut dbfile = File::open(&squozen.path)?;
|
||||
let mut dbbuffer = Bufreader::new(dbfile);
|
||||
dbbuffer.seek(BIGRAMS);
|
||||
|
@ -104,3 +104,17 @@ pub impl<'a> Iterator for StoredPath {
|
|||
Some(&self.path)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct FoundPath {
|
||||
stored: StoredPath,
|
||||
pattern: Vec<u8>,
|
||||
}
|
||||
|
||||
pub impl<'a> FoundPath {
|
||||
pub fn new(squozen: &'a Squozen, path: &[u8]) -> Result<FoundPath, Error> {
|
||||
Ok(FoundPath {
|
||||
stored: StoredPath::new(squozen),
|
||||
pattern: prepare_pattern(path)?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue