Compare commits
No commits in common. "c2cfd3f72cde0ad54e5cb8337f1de4a10e6df36d" and "55c65fe30e7a92a4e093556baffac953c0cb9f55" have entirely different histories.
c2cfd3f72c
...
55c65fe30e
1 changed files with 3 additions and 2 deletions
|
@ -7,6 +7,7 @@ use rusqlite::Connection;
|
||||||
|
|
||||||
use crate::document::document::Document;
|
use crate::document::document::Document;
|
||||||
use crate::document::document::ElemReference;
|
use crate::document::document::ElemReference;
|
||||||
|
use crate::document::element::ReferenceableElement;
|
||||||
use crate::document::variable::Variable;
|
use crate::document::variable::Variable;
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
|
@ -39,7 +40,7 @@ impl Compiler {
|
||||||
|
|
||||||
/// Inserts or get a reference id for the compiled document
|
/// Inserts or get a reference id for the compiled document
|
||||||
///
|
///
|
||||||
/// # Parameters
|
/// # Parameters
|
||||||
/// - [`reference`] The reference to get or insert
|
/// - [`reference`] The reference to get or insert
|
||||||
pub fn reference_id<'a>(&self, document: &'a dyn Document, reference: ElemReference) -> usize {
|
pub fn reference_id<'a>(&self, document: &'a dyn Document, reference: ElemReference) -> usize {
|
||||||
let mut borrow = self.reference_count.borrow_mut();
|
let mut borrow = self.reference_count.borrow_mut();
|
||||||
|
@ -61,7 +62,7 @@ impl Compiler {
|
||||||
// Insert new ref
|
// Insert new ref
|
||||||
let index = map
|
let index = map
|
||||||
.iter()
|
.iter()
|
||||||
.fold(0, |max, (_, value)| std::cmp::max(max, *value));
|
.fold(0, |max, (name, value)| std::cmp::max(max, *value));
|
||||||
map.insert(refname.clone(), index + 1);
|
map.insert(refname.clone(), index + 1);
|
||||||
index + 1
|
index + 1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue