pub struct BibEntry {
pub entry_type: String,
pub key: String,
pub key_span: Range<usize>,
pub fields: BTreeMap<String, String>,
}Expand description
A single parsed BibTeX entry: one @type{...} record.
The entry type and field names are normalized to lowercase, because
BibTeX treats them case-insensitively; the citation key is
preserved verbatim, because keys are case-sensitive. Fields live in a
BTreeMap, so fields iterates in sorted, stable
order. Values are stored as raw text exactly as written between the
delimiters; no TeX decoding or name parsing.
§Examples
use mos_bib::parse_bibtex;
let bib = parse_bibtex("@article{knuth1984, title = {Literate Programming}}")?;
let entry = &bib.entries["knuth1984"];
assert_eq!(entry.entry_type, "article");
assert_eq!(entry.key, "knuth1984");
assert_eq!(entry.fields["title"], "Literate Programming");Fields§
§entry_type: StringThe entry type without the leading @, lowercased (e.g. article).
key: StringThe citation key, preserved verbatim (e.g. knuth1984).
key_span: Range<usize>Byte range of key inside the parsed BibTeX source.
fields: BTreeMap<String, String>Field name (lowercased) to raw value text, in sorted name order.
Trait Implementations§
impl Eq for BibEntry
impl StructuralPartialEq for BibEntry
Auto Trait Implementations§
impl Freeze for BibEntry
impl RefUnwindSafe for BibEntry
impl Send for BibEntry
impl Sync for BibEntry
impl Unpin for BibEntry
impl UnsafeUnpin for BibEntry
impl UnwindSafe for BibEntry
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