Skip to main content

ReferenceFormatter

Struct ReferenceFormatter 

Source
pub struct ReferenceFormatter { /* private fields */ }
Expand description

Immutable options for localized reference and passage formatting.

The default formatter uses English long book names and compact ranges. A language without bundled names falls back to English deterministically.

Implementations§

Source§

impl ReferenceFormatter

Source

pub const DEFAULT: ReferenceFormatter

The default English, long-name, compact-range formatter.

Source

pub const fn new() -> ReferenceFormatter

Construct a formatter with the package defaults.

Source

pub const fn with_options( language: Language, book_name_style: BookNameStyle, compact_ranges: bool, ) -> ReferenceFormatter

Construct a formatter from all configuration values.

Source

pub const fn for_language(language: Language) -> ReferenceFormatter

Construct a formatter for one language, retaining the other defaults.

Source

pub const fn language(self) -> Language

Return the requested output language.

Source

pub const fn book_name_style(self) -> BookNameStyle

Return the configured book-name style.

Source

pub const fn compact_ranges(self) -> bool

Return whether repeated components are omitted from ranges and lists.

Source

pub const fn with_language(self, language: Language) -> ReferenceFormatter

Return a copy configured for language.

Source

pub const fn with_book_name_style( self, book_name_style: BookNameStyle, ) -> ReferenceFormatter

Return a copy configured to use book_name_style.

Source

pub const fn with_compact_ranges( self, compact_ranges: bool, ) -> ReferenceFormatter

Return a copy configured to compact or expand repeated range components.

Source

pub fn book_name(self, book: Book) -> &'static str

Return the preferred localized display name for book.

Source

pub fn format_book_name(self, book: Book) -> &'static str

Alias for Self::book_name matching the Dart package terminology.

Source

pub const fn format_book(self, book: Book) -> FormattedBook

Wrap a book in a lazily evaluated fmt::Display adapter.

Source

pub fn format(self, reference: impl Into<Reference>) -> FormattedReference

Wrap a verse or verse range in a localized fmt::Display adapter.

Source

pub fn format_reference( self, reference: impl Into<Reference>, ) -> FormattedReference

Wrap a verse or verse range in a localized fmt::Display adapter.

Source

pub const fn format_passage<'a>( self, passage: &'a Passage, ) -> FormattedPassage<'a>

Wrap a whole passage expression in a localized fmt::Display adapter.

Source

pub const fn format_book_passage( self, passage: BookPassage, ) -> FormattedBookPassage

Wrap a whole-book passage in a localized fmt::Display adapter.

Source

pub const fn format_chapter_passage( self, passage: ChapterPassage, ) -> FormattedChapterPassage

Wrap a chapter passage in a localized fmt::Display adapter.

Source

pub const fn format_verse_passage<'a>( self, passage: &'a VersePassage, ) -> FormattedVersePassage<'a>

Wrap a verse-selection passage in a localized fmt::Display adapter.

Source

pub const fn format_passage_sequence<'a>( self, passage: &'a PassageSequence, ) -> FormattedPassageSequence<'a>

Wrap a passage sequence in a localized fmt::Display adapter.

Trait Implementations§

Source§

impl Clone for ReferenceFormatter

Source§

fn clone(&self) -> ReferenceFormatter

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ReferenceFormatter

Source§

impl Debug for ReferenceFormatter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for ReferenceFormatter

Source§

fn default() -> ReferenceFormatter

Returns the “default value” for a type. Read more
Source§

impl Eq for ReferenceFormatter

Source§

impl From<Language> for ReferenceFormatter

Source§

fn from(language: Language) -> ReferenceFormatter

Converts to this type from the input type.
Source§

impl Hash for ReferenceFormatter

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ReferenceFormatter

Source§

fn eq(&self, other: &ReferenceFormatter) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ReferenceFormatter

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.