Skip to main content

ParsedEntry

Struct ParsedEntry 

Source
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: ParsedEntryStatus

Whether 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>

Source

pub fn from_entry(entry: Entry<'a>, source: Option<SourceSpan>) -> Self

Create parsed-entry metadata from a structured entry.

Source

pub fn key(&self) -> &str

Return the citation key.

Source

pub fn into_entry(self) -> Entry<'a>

Convert this parsed entry into the structured entry.

Source

pub fn rename_key(&mut self, key: impl Into<Cow<'a, str>>)

Rename the citation key.

Source

pub fn set_entry_type(&mut self, ty: EntryType<'a>)

Replace the entry type.

Source

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.

Source

pub fn replace_field_value(&mut self, name: &str, value: Value<'a>) -> bool

Replace the first field value whose name matches exactly.

Source

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.

Source

pub fn rename_field(&mut self, old: &str, new: impl Into<Cow<'a, str>>) -> usize

Rename all fields whose name matches exactly.

Source

pub fn remove_field(&mut self, name: &str) -> usize

Remove all fields whose name matches exactly.

Source

pub fn remove_field_at(&mut self, name: &str, occurrence: usize) -> bool

Remove a specific duplicate field occurrence by zero-based occurrence index.

Source

pub fn remove_export_fields(&mut self, names: &[&str]) -> usize

Remove configured export-only fields from this entry.

Source

pub fn field_ignore_case(&self, name: &str) -> Option<&ParsedField<'a>>

Return the first field matching name, ignoring ASCII case.

Source

pub fn get_as_string_ignore_case(&self, name: &str) -> Option<String>

Return a field value as ordinary text, ignoring ASCII case.

Source

pub fn doi(&self) -> Option<String>

Return the normalized DOI, if the entry has a recognizable DOI field.

Source

pub fn authors(&self) -> Vec<PersonName>

Parse the author field into structured BibTeX names.

Source

pub fn editors(&self) -> Vec<PersonName>

Parse the editor field into structured BibTeX names.

Source

pub fn translators(&self) -> Vec<PersonName>

Parse the translator field into structured BibTeX names.

Source

pub fn date_parts_for( &self, field: &str, ) -> Option<Result<DateParts, DateParseError>>

Parse a specific date-like field into date parts.

Source

pub fn date_parts(&self) -> Option<Result<DateParts, DateParseError>>

Return issued date parts for this entry.

Source

pub fn resource_fields(&self) -> Vec<ResourceField>

Return classified resource and identifier fields in source order.

Source

pub fn into_owned(self) -> ParsedEntry<'static>

Convert this parsed entry into an owned value.

Trait Implementations§

Source§

impl<'a> Clone for ParsedEntry<'a>

Source§

fn clone(&self) -> ParsedEntry<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for ParsedEntry<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> PartialEq for ParsedEntry<'a>

Source§

fn eq(&self, other: &ParsedEntry<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Ungil for T
where T: Send,