pub struct Citation {
pub refs: Vec<String>,
pub locator: Option<String>,
pub locator_type: Option<LocatorType>,
pub prefix: Option<String>,
pub suffix: Option<String>,
pub suppress_author: bool,
}Expand description
An inline citation reference.
Supports both single and multi-reference citations (e.g., [smith2023; jones2024]).
§Backward Compatibility
Deserializes from both the old singular "ref" (string) format and the
new "refs" (array) format.
Fields§
§refs: Vec<String>References to bibliography entry IDs.
locator: Option<String>Page or location within the reference.
locator_type: Option<LocatorType>Locator type (page, chapter, section, etc.).
prefix: Option<String>Text before the citation (e.g., “see”).
suffix: Option<String>Text after the citation (e.g., “for details”).
Suppress author name in citation.
Implementations§
Source§impl Citation
impl Citation
Sourcepub fn new(reference: impl Into<String>) -> Self
pub fn new(reference: impl Into<String>) -> Self
Create a new citation with a single reference.
Sourcepub fn multi(refs: Vec<String>) -> Self
pub fn multi(refs: Vec<String>) -> Self
Create a citation with multiple references (e.g., [smith2023; jones2024]).
Sourcepub fn with_locator(
self,
locator: impl Into<String>,
locator_type: LocatorType,
) -> Self
pub fn with_locator( self, locator: impl Into<String>, locator_type: LocatorType, ) -> Self
Set locator with type.
Sourcepub fn with_prefix(self, prefix: impl Into<String>) -> Self
pub fn with_prefix(self, prefix: impl Into<String>) -> Self
Set prefix text.
Sourcepub fn with_suffix(self, suffix: impl Into<String>) -> Self
pub fn with_suffix(self, suffix: impl Into<String>) -> Self
Set suffix text.
Suppress author name.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Citation
impl<'de> Deserialize<'de> for Citation
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Citation
impl StructuralPartialEq for Citation
Auto Trait Implementations§
impl Freeze for Citation
impl RefUnwindSafe for Citation
impl Send for Citation
impl Sync for Citation
impl Unpin for Citation
impl UnsafeUnpin for Citation
impl UnwindSafe for Citation
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.