pub enum LanguageRecord {
Parsed(LanguageTag<String>),
Raw {
value: String,
error_msg: String,
},
}Expand description
Enum to encode the possible outcomes of parsing a language tag.
Variants§
Parsed(LanguageTag<String>)
Variant containing a successfully parsed language tag.
Raw
Variant containing the raw value of the language tag if parsing failed.
Implementations§
Source§impl LanguageRecord
impl LanguageRecord
Sourcepub fn new(language_tag: String) -> Self
pub fn new(language_tag: String) -> Self
Constructs a new LanguageRecord, regardless of whether oxilangtag parsed
it successfully.
Sourcepub fn primary(&self) -> Result<String, RecordDataError>
pub fn primary(&self) -> Result<String, RecordDataError>
Returns the primary language subtag,
as extracted by oxilangtag.
See oxilangtag::LanguageTag::primary_language
§Errors
If oxilangtag cannot parse the original record’s language tag, the error value will be the original record’s language tag as it was specified in the record (or None if the record didn’t have one).
Trait Implementations§
Source§impl Clone for LanguageRecord
impl Clone for LanguageRecord
Source§fn clone(&self) -> LanguageRecord
fn clone(&self) -> LanguageRecord
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LanguageRecord
impl Debug for LanguageRecord
Source§impl Display for LanguageRecord
impl Display for LanguageRecord
Source§impl PartialEq for LanguageRecord
impl PartialEq for LanguageRecord
Source§fn eq(&self, other: &LanguageRecord) -> bool
fn eq(&self, other: &LanguageRecord) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for LanguageRecord
Auto Trait Implementations§
impl Freeze for LanguageRecord
impl RefUnwindSafe for LanguageRecord
impl Send for LanguageRecord
impl Sync for LanguageRecord
impl Unpin for LanguageRecord
impl UnsafeUnpin for LanguageRecord
impl UnwindSafe for LanguageRecord
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