Add create_child method to BibManager

Signed-off-by: trivernis <trivernis@protonmail.com>
main
trivernis 4 years ago
parent 17f5703d4a
commit 2a1cd25122
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -1,7 +1,7 @@
[package] [package]
name = "bibliographix" name = "bibliographix"
description = "A bibliography management crate." description = "A bibliography management crate."
version = "0.1.0" version = "0.2.0"
authors = ["trivernis <trivernis@protonmail.com>"] authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018" edition = "2018"
license = "Apache-2.0" license = "Apache-2.0"

@ -24,6 +24,17 @@ impl BibManager {
Arc::clone(&self.root_ref_anchor) Arc::clone(&self.root_ref_anchor)
} }
/// Creates a new child BibManager with a child anchor and the parents entry dict
pub fn create_child(&self) -> BibManager {
let anchor = self.root_ref_anchor.lock().unwrap().create_anchor();
let entry_dict = Arc::clone(&self.entry_dictionary);
Self {
entry_dictionary: entry_dict,
root_ref_anchor: anchor,
}
}
/// Returns the reference to the entry dictionary /// Returns the reference to the entry dictionary
pub fn entry_dictionary(&self) -> Arc<Mutex<BibliographyDictionary>> { pub fn entry_dictionary(&self) -> Arc<Mutex<BibliographyDictionary>> {
Arc::clone(&self.entry_dictionary) Arc::clone(&self.entry_dictionary)

Loading…
Cancel
Save