Skip to main content

ReferenceParser

Struct ReferenceParser 

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

A reusable parser with immutable alias and ambiguity configuration.

Implementations§

Source§

impl ReferenceParser

Source

pub fn new() -> ReferenceParser

Construct a parser with bundled aliases and automatic detection.

Source

pub fn builder() -> ParserBuilder

Start configuring a parser.

Source

pub fn preferred_languages(&self) -> &[Language]

Return configured preferred languages.

Source

pub fn aliases(&self) -> impl Iterator<Item = (&str, Book)>

Iterate over configured language-neutral aliases in registration order.

Source

pub fn aliases_by_language( &self, ) -> impl Iterator<Item = (Language, &str, Book)>

Iterate over configured language-specific aliases in registration order.

Source

pub const fn ambiguity_policy(&self) -> AmbiguityPolicy

Return this parser’s ambiguity policy.

Source

pub fn parse(&self, input: &str) -> Result<Reference, ParseError>

Parse a single verse or an inclusive range using automatic detection.

Source

pub fn parse_with_language( &self, input: &str, language: Language, ) -> Result<Reference, ParseError>

Parse a reference using one explicit language.

Source

pub fn parse_detailed( &self, input: &str, ) -> Result<Parsed<Reference>, ParseError>

Parse a reference and retain normalization and language metadata.

Source

pub fn parse_detailed_with_language( &self, input: &str, language: Language, ) -> Result<Parsed<Reference>, ParseError>

Parse with an explicit language and retain metadata.

Source

pub fn try_parse(&self, input: &str) -> Option<Reference>

Return None rather than an error for invalid input.

Source

pub fn try_parse_with_language( &self, input: &str, language: Language, ) -> Option<Reference>

Parse with an explicit language, returning None for invalid input.

Source

pub fn parse_book(&self, input: &str) -> Result<Book, ParseError>

Resolve a standalone book token using automatic language detection.

Source

pub fn parse_book_with_language( &self, input: &str, language: Language, ) -> Result<Book, ParseError>

Resolve a standalone book token using an explicit language.

Source

pub fn parse_book_detailed( &self, input: &str, ) -> Result<Parsed<Book>, ParseError>

Resolve a standalone book token and retain detection metadata.

Source

pub fn parse_book_detailed_with_language( &self, input: &str, language: Language, ) -> Result<Parsed<Book>, ParseError>

Resolve a standalone book token with an explicit language and metadata.

Source

pub fn parse_verse(&self, input: &str) -> Result<VerseRef, ParseError>

Parse only a single verse.

Source

pub fn parse_verse_with_language( &self, input: &str, language: Language, ) -> Result<VerseRef, ParseError>

Parse only a single verse with an explicit language.

Source

pub fn parse_verse_detailed( &self, input: &str, ) -> Result<Parsed<VerseRef>, ParseError>

Parse only a single verse and retain detection metadata.

Source

pub fn parse_verse_detailed_with_language( &self, input: &str, language: Language, ) -> Result<Parsed<VerseRef>, ParseError>

Parse only a single verse with an explicit language and metadata.

Source

pub fn try_parse_verse(&self, input: &str) -> Option<VerseRef>

Parse only a single verse, returning None for invalid input.

Source

pub fn try_parse_verse_with_language( &self, input: &str, language: Language, ) -> Option<VerseRef>

Parse only a single verse with an explicit language, returning None for invalid input.

Source

pub fn parse_range(&self, input: &str) -> Result<VerseRange, ParseError>

Parse only a range.

Source

pub fn parse_range_with_language( &self, input: &str, language: Language, ) -> Result<VerseRange, ParseError>

Parse only a range with an explicit language.

Source

pub fn parse_range_detailed( &self, input: &str, ) -> Result<Parsed<VerseRange>, ParseError>

Parse only a range and retain detection metadata.

Source

pub fn parse_range_detailed_with_language( &self, input: &str, language: Language, ) -> Result<Parsed<VerseRange>, ParseError>

Parse only a range with an explicit language and metadata.

Source

pub fn try_parse_range(&self, input: &str) -> Option<VerseRange>

Parse only a range, returning None for invalid input.

Source

pub fn try_parse_range_with_language( &self, input: &str, language: Language, ) -> Option<VerseRange>

Parse only a range with an explicit language, returning None for invalid input.

Trait Implementations§

Source§

impl Clone for ReferenceParser

Source§

fn clone(&self) -> ReferenceParser

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 Debug for ReferenceParser

Source§

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

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

impl Default for ReferenceParser

Source§

fn default() -> ReferenceParser

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

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<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.