pub struct ParsedEntry<'a> {
pub ty: EntryType<'a>,
pub key: Cow<'a, str>,
pub fields: Vec<ParsedField<'a>>,
pub status: ParsedEntryStatus,
pub source: Option<SourceSpan>,
pub entry_type_source: Option<SourceSpan>,
pub key_source: Option<SourceSpan>,
pub delimiter: Option<EntryDelimiter>,
pub raw: Option<Cow<'a, str>>,
pub diagnostics: Vec<Diagnostic>,
}Expand description
Parsed entry plus optional source-preserving metadata.
Fields§
§ty: EntryType<'a>Entry type.
key: Cow<'a, str>Citation key.
fields: Vec<ParsedField<'a>>Parsed fields in source order.
status: ParsedEntryStatusWhether the entry is complete or recovered.
source: Option<SourceSpan>Source location for the whole entry, when available.
entry_type_source: Option<SourceSpan>Source location for the entry type token, when available.
key_source: Option<SourceSpan>Source location for the citation key token, when available.
delimiter: Option<EntryDelimiter>Entry body delimiter, when retained.
raw: Option<Cow<'a, str>>Exact raw entry text, when retained by the parser mode.
diagnostics: Vec<Diagnostic>Diagnostics attached to this entry.
Implementations§
Source§impl<'a> ParsedEntry<'a>
impl<'a> ParsedEntry<'a>
Sourcepub fn from_entry(entry: Entry<'a>, source: Option<SourceSpan>) -> Self
pub fn from_entry(entry: Entry<'a>, source: Option<SourceSpan>) -> Self
Create parsed-entry metadata from a structured entry.
Sourcepub fn into_entry(self) -> Entry<'a>
pub fn into_entry(self) -> Entry<'a>
Convert this parsed entry into the structured entry.
Sourcepub fn rename_key(&mut self, key: impl Into<Cow<'a, str>>)
pub fn rename_key(&mut self, key: impl Into<Cow<'a, str>>)
Rename the citation key.
Sourcepub fn set_entry_type(&mut self, ty: EntryType<'a>)
pub fn set_entry_type(&mut self, ty: EntryType<'a>)
Replace the entry type.
Sourcepub fn add_field(&mut self, name: impl Into<Cow<'a, str>>, value: Value<'a>)
pub fn add_field(&mut self, name: impl Into<Cow<'a, str>>, value: Value<'a>)
Add a field and switch this entry to structured writing.
Sourcepub fn replace_field_value(&mut self, name: &str, value: Value<'a>) -> bool
pub fn replace_field_value(&mut self, name: &str, value: Value<'a>) -> bool
Replace the first field value whose name matches exactly.
Sourcepub fn replace_field_value_at(
&mut self,
name: &str,
occurrence: usize,
value: Value<'a>,
) -> bool
pub fn replace_field_value_at( &mut self, name: &str, occurrence: usize, value: Value<'a>, ) -> bool
Replace a specific duplicate field occurrence by zero-based occurrence index.
Sourcepub fn rename_field(&mut self, old: &str, new: impl Into<Cow<'a, str>>) -> usize
pub fn rename_field(&mut self, old: &str, new: impl Into<Cow<'a, str>>) -> usize
Rename all fields whose name matches exactly.
Sourcepub fn remove_field(&mut self, name: &str) -> usize
pub fn remove_field(&mut self, name: &str) -> usize
Remove all fields whose name matches exactly.
Sourcepub fn remove_field_at(&mut self, name: &str, occurrence: usize) -> bool
pub fn remove_field_at(&mut self, name: &str, occurrence: usize) -> bool
Remove a specific duplicate field occurrence by zero-based occurrence index.
Sourcepub fn remove_export_fields(&mut self, names: &[&str]) -> usize
pub fn remove_export_fields(&mut self, names: &[&str]) -> usize
Remove configured export-only fields from this entry.
Sourcepub fn field_ignore_case(&self, name: &str) -> Option<&ParsedField<'a>>
pub fn field_ignore_case(&self, name: &str) -> Option<&ParsedField<'a>>
Return the first field matching name, ignoring ASCII case.
Sourcepub fn get_as_string_ignore_case(&self, name: &str) -> Option<String>
pub fn get_as_string_ignore_case(&self, name: &str) -> Option<String>
Return a field value as ordinary text, ignoring ASCII case.
Sourcepub fn doi(&self) -> Option<String>
pub fn doi(&self) -> Option<String>
Return the normalized DOI, if the entry has a recognizable DOI field.
Parse the author field into structured BibTeX names.
Sourcepub fn editors(&self) -> Vec<PersonName>
pub fn editors(&self) -> Vec<PersonName>
Parse the editor field into structured BibTeX names.
Sourcepub fn translators(&self) -> Vec<PersonName>
pub fn translators(&self) -> Vec<PersonName>
Parse the translator field into structured BibTeX names.
Sourcepub fn date_parts_for(
&self,
field: &str,
) -> Option<Result<DateParts, DateParseError>>
pub fn date_parts_for( &self, field: &str, ) -> Option<Result<DateParts, DateParseError>>
Parse a specific date-like field into date parts.
Sourcepub fn date_parts(&self) -> Option<Result<DateParts, DateParseError>>
pub fn date_parts(&self) -> Option<Result<DateParts, DateParseError>>
Return issued date parts for this entry.
Sourcepub fn resource_fields(&self) -> Vec<ResourceField>
pub fn resource_fields(&self) -> Vec<ResourceField>
Return classified resource and identifier fields in source order.
Sourcepub fn into_owned(self) -> ParsedEntry<'static>
pub fn into_owned(self) -> ParsedEntry<'static>
Convert this parsed entry into an owned value.
Trait Implementations§
Source§impl<'a> Clone for ParsedEntry<'a>
impl<'a> Clone for ParsedEntry<'a>
Source§fn clone(&self) -> ParsedEntry<'a>
fn clone(&self) -> ParsedEntry<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for ParsedEntry<'a>
impl<'a> Debug for ParsedEntry<'a>
Source§impl<'a> PartialEq for ParsedEntry<'a>
impl<'a> PartialEq for ParsedEntry<'a>
Source§fn eq(&self, other: &ParsedEntry<'a>) -> bool
fn eq(&self, other: &ParsedEntry<'a>) -> bool
self and other values to be equal, and is used by ==.impl<'a> StructuralPartialEq for ParsedEntry<'a>
Auto Trait Implementations§
impl<'a> Freeze for ParsedEntry<'a>
impl<'a> RefUnwindSafe for ParsedEntry<'a>
impl<'a> Send for ParsedEntry<'a>
impl<'a> Sync for ParsedEntry<'a>
impl<'a> Unpin for ParsedEntry<'a>
impl<'a> UnsafeUnpin for ParsedEntry<'a>
impl<'a> UnwindSafe for ParsedEntry<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more