pub struct DbPool {
pub zotero: Option<ZoteroDb>,
pub bbt: Option<BbtDb>,
}Expand description
Holds connections to both Zotero databases.
Created once at startup and shared (by reference) across all tool calls. Both connections are read-only and held open for the process lifetime.
Fields§
§zotero: Option<ZoteroDb>§bbt: Option<BbtDb>Implementations§
Source§impl DbPool
impl DbPool
Sourcepub fn open(zotero_path: &Path, bbt_path: &Path) -> Self
pub fn open(zotero_path: &Path, bbt_path: &Path) -> Self
Open both databases. Non-fatal: if a database doesn’t exist or can’t be opened, the corresponding field is None and tools that need it return a clear error.
Sourcepub fn zotero(&self) -> Result<&ZoteroDb>
pub fn zotero(&self) -> Result<&ZoteroDb>
Get the Zotero database, returning a clear error if unavailable.
Sourcepub fn bbt(&self) -> Result<&BbtDb>
pub fn bbt(&self) -> Result<&BbtDb>
Get the BBT database, returning a clear error if unavailable.
Sourcepub fn item_key_for_citekey(&self, citekey: &str) -> Result<Option<String>>
pub fn item_key_for_citekey(&self, citekey: &str) -> Result<Option<String>>
Resolve a citekey to an item key, trying all available sources.
Priority:
zotero.sqlitecitationKey field (most complete, 99.9% coverage)better-bibtex.migrated(for items not yet synced to Zotero)
Sourcepub fn citekey_for_item_key(&self, item_key: &str) -> Option<String>
pub fn citekey_for_item_key(&self, item_key: &str) -> Option<String>
Resolve an item key to a citekey, trying all available sources.
Auto Trait Implementations§
impl !Freeze for DbPool
impl !RefUnwindSafe for DbPool
impl Send for DbPool
impl !Sync for DbPool
impl Unpin for DbPool
impl !UnwindSafe for DbPool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more