pub struct ReferenceSorter<'a> { /* private fields */ }Expand description
Sorts grouped bibliography entries using group-specific sort rules.
Implementations§
Source§impl<'a> ReferenceSorter<'a>
impl<'a> ReferenceSorter<'a>
Sourcepub fn new(locale: &'a Locale) -> Self
pub fn new(locale: &'a Locale) -> Self
Create a sorter that uses locale for locale-sensitive comparisons.
Sourcepub fn with_bibliography_config(locale: &'a Locale, config: &'a Config) -> Self
pub fn with_bibliography_config(locale: &'a Locale, config: &'a Config) -> Self
Create a bibliography sorter using the effective bibliography config.
Sourcepub fn with_bibliography_spec(self, spec: &'a BibliographySpec) -> Self
pub fn with_bibliography_spec(self, spec: &'a BibliographySpec) -> Self
Use the effective bibliography template to resolve list-form author keys.
Sourcepub fn with_citation_spec(self, spec: &'a CitationSpec) -> Self
pub fn with_citation_spec(self, spec: &'a CitationSpec) -> Self
Use the effective citation template to resolve list-form author keys.
Sourcepub fn sort_references<'b>(
&self,
references: Vec<&'b Reference>,
sort_spec: &GroupSort,
) -> Vec<&'b Reference>
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 sortsort_spec- Group sort specification
Sourcepub fn sort_references_with_id_tiebreak<'b>(
&self,
references: Vec<&'b Reference>,
sort_spec: &GroupSort,
) -> Vec<&'b Reference>
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.
Sourcepub fn compare_by_key(
&self,
a: &Reference,
b: &Reference,
sort_key: &GroupSortKey,
) -> Ordering
pub fn compare_by_key( &self, a: &Reference, b: &Reference, sort_key: &GroupSortKey, ) -> Ordering
Compare two references by a single sort key.
Public helper retained for tests/debugging.