pub struct BiblatexUtils;Expand description
Utility functions for prepyrus for working with BibTeX files.
Implementations§
Source§impl BiblatexUtils
impl BiblatexUtils
Sourcepub fn retrieve_bibliography_entries(
bibliography_path: &str,
) -> Result<Vec<Entry>, BibliographyError>
pub fn retrieve_bibliography_entries( bibliography_path: &str, ) -> Result<Vec<Entry>, BibliographyError>
Retrieve bibliography entries from a BibTeX file.
Sourcepub fn extract_year_from_date(
date: &PermissiveType<Date>,
reference: String,
) -> Result<i32, String>
pub fn extract_year_from_date( date: &PermissiveType<Date>, reference: String, ) -> Result<i32, String>
Extract the year from a date that is inside of a permissive type.
Sourcepub fn extract_volume(volume: &PermissiveType<i64>) -> i64
pub fn extract_volume(volume: &PermissiveType<i64>) -> i64
Extract volume from a permissive type.
Sourcepub fn extract_pages(pages: &PermissiveType<Vec<Range<u32>>>) -> String
pub fn extract_pages(pages: &PermissiveType<Vec<Range<u32>>>) -> String
Extract pages from a permissive type.
Sourcepub fn extract_spanned_chunk(spanned_chunk: &[Spanned<Chunk>]) -> String
pub fn extract_spanned_chunk(spanned_chunk: &[Spanned<Chunk>]) -> String
Use this to extract from a Spanned<Chunk> vector
use biblatex::{Chunk, Entry, EntryType, Spanned};
use prepyrus::utils::BiblatexUtils;
// Mocking a Spanned<Chunk> vector
let address_spanned: &[Spanned<Chunk>] = &[
Spanned {
v: Chunk::Normal("123 Fake Street".into()),
span: Default::default(),
},
Spanned {
v: Chunk::Normal("Springfield".into()),
span: Default::default(),
},
];
let address: String = BiblatexUtils::extract_spanned_chunk(&address_spanned);
assert_eq!(address, "123 Fake StreetSpringfield");Auto Trait Implementations§
impl Freeze for BiblatexUtils
impl RefUnwindSafe for BiblatexUtils
impl Send for BiblatexUtils
impl Sync for BiblatexUtils
impl Unpin for BiblatexUtils
impl UnwindSafe for BiblatexUtils
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> 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