Skip to main content

ReferenceSorter

Struct ReferenceSorter 

Source
pub struct ReferenceSorter<'a> { /* private fields */ }
Expand description

Sorts grouped bibliography entries using group-specific sort rules.

Implementations§

Source§

impl<'a> ReferenceSorter<'a>

Source

pub fn new(locale: &'a Locale) -> Self

Create a sorter that uses locale for locale-sensitive comparisons.

Source

pub fn with_bibliography_config(locale: &'a Locale, config: &'a Config) -> Self

Create a bibliography sorter using the effective bibliography config.

Source

pub fn with_bibliography_spec(self, spec: &'a BibliographySpec) -> Self

Use the effective bibliography template to resolve list-form author keys.

Source

pub fn with_citation_spec(self, spec: &'a CitationSpec) -> Self

Use the effective citation template to resolve list-form author keys.

Source

pub fn sort_references<'b>( &self, references: Vec<&'b Reference>, sort_spec: &GroupSort, ) -> Vec<&'b Reference>

Sort references according to a group sort specification.

Applies sort keys in order, with later keys acting as tiebreakers.

§Arguments
  • references - References to sort
  • sort_spec - Group sort specification
Source

pub fn sort_references_with_id_tiebreak<'b>( &self, references: Vec<&'b Reference>, sort_spec: &GroupSort, ) -> Vec<&'b Reference>

Sort references according to a group sort specification, breaking ties between references whose keys compare equal by comparing reference IDs.

References without an ID sort after references with one. The tiebreak makes config-driven bibliography sorts fully deterministic, and is opt-in because most ReferenceSorter call sites (grouping/render paths) rely on stable-sort/registry order for equal keys instead.

An empty sort template is a no-op: with no keys to compare, references keep registry order rather than being reordered by ID alone.

Source

pub fn compare_by_key( &self, a: &Reference, b: &Reference, sort_key: &GroupSortKey, ) -> Ordering

Compare two references by a single sort key.

Source

pub fn extract_author_sort_key( &self, reference: &Reference, name_order: NameSortOrder, ) -> String

Public helper retained for tests/debugging.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for ReferenceSorter<'a>

§

impl<'a> !UnwindSafe for ReferenceSorter<'a>

§

impl<'a> Freeze for ReferenceSorter<'a>

§

impl<'a> Send for ReferenceSorter<'a>

§

impl<'a> Sync for ReferenceSorter<'a>

§

impl<'a> Unpin for ReferenceSorter<'a>

§

impl<'a> UnsafeUnpin for ReferenceSorter<'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> ErasedDestructor for T
where T: 'static,

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> Same for T

Source§

type Output = T

Should always be Self
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.