Introduce a basic cache system for first letters

This commit is contained in:
Clément Renault
2019-12-21 13:44:19 +01:00
parent d21352a109
commit 1e1f0fcaf5
10 changed files with 211 additions and 0 deletions

View File

@ -81,6 +81,16 @@ fn highlights_from_raw_document<'a, 'tag, 'txn>(
}
impl Document {
#[cfg(not(test))]
pub fn from_highlights(id: DocumentId, highlights: &[Highlight]) -> Document {
Document { id, highlights: highlights.to_owned() }
}
#[cfg(test)]
pub fn from_highlights(id: DocumentId, highlights: &[Highlight]) -> Document {
Document { id, highlights: highlights.to_owned(), matches: Vec::new() }
}
#[cfg(not(test))]
pub fn from_raw<'a, 'tag, 'txn>(
raw_document: RawDocument<'a, 'tag>,