pub struct Preamble<'a> {
pub value: Value<'a>,
pub source: Option<SourceSpan>,
}Expand description
A BibTeX preamble block.
Fields§
§value: Value<'a>Expanded preamble value.
source: Option<SourceSpan>Optional source location.
Implementations§
Methods from Deref<Target = Value<'a>>§
Sourcepub fn expand(&self, strings: &AHashMap<&str, Value<'_>>) -> String
pub fn expand(&self, strings: &AHashMap<&str, Value<'_>>) -> String
Expand variables and concatenations to get final string
Sourcepub fn to_plain_string(&self) -> String
pub fn to_plain_string(&self) -> String
Project this value to ordinary text without adding unresolved-variable markers.
Literals and numbers become their text form, variables become their variable name, and concatenations are joined recursively. This allocates when the value is not already a simple borrowed literal.
Sourcepub fn to_lossy_string(&self) -> String
pub fn to_lossy_string(&self) -> String
Project this value to display text, marking unresolved variables as {name}.
Sourcepub fn to_bibtex_source(&self) -> String
pub fn to_bibtex_source(&self) -> String
Serialize this value as a BibTeX value fragment.
This is a normalized source projection. Use source-preserving parsing when callers need the exact original spelling or delimiters.
Sourcepub fn to_unicode_plain_string(&self) -> String
pub fn to_unicode_plain_string(&self) -> String
Project this value to ordinary text and convert common LaTeX sequences to Unicode.
Trait Implementations§
Source§impl<'a> PartialEq for Preamble<'a>
impl<'a> PartialEq for Preamble<'a>
impl<'a> StructuralPartialEq for Preamble<'a>
Auto Trait Implementations§
impl<'a> Freeze for Preamble<'a>
impl<'a> RefUnwindSafe for Preamble<'a>
impl<'a> Send for Preamble<'a>
impl<'a> Sync for Preamble<'a>
impl<'a> Unpin for Preamble<'a>
impl<'a> UnsafeUnpin for Preamble<'a>
impl<'a> UnwindSafe for Preamble<'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
Mutably borrows from an owned value. Read more
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>
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 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>
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