pub struct LanguageCode(/* private fields */);Expand description
ISO 639-1 language code newtype (two lowercase ASCII letters, e.g. "en").
Construction always validates the code; use LanguageCode::new or
LanguageCode::try_from.
Implementations§
Source§impl LanguageCode
impl LanguageCode
Sourcepub fn new(code: &str) -> Result<Self, CaptionGenError>
pub fn new(code: &str) -> Result<Self, CaptionGenError>
Create a validated ISO 639-1 language code.
The code must be exactly two ASCII lowercase letters (a-z).
§Errors
Returns CaptionGenError::InvalidParameter if the code is not exactly
two lowercase ASCII letters.
Trait Implementations§
Source§impl Clone for LanguageCode
impl Clone for LanguageCode
Source§fn clone(&self) -> LanguageCode
fn clone(&self) -> LanguageCode
Returns a duplicate of the value. Read more
1.0.0 · 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 LanguageCode
impl Debug for LanguageCode
Source§impl Display for LanguageCode
impl Display for LanguageCode
Source§impl Hash for LanguageCode
impl Hash for LanguageCode
Source§impl PartialEq for LanguageCode
impl PartialEq for LanguageCode
Source§impl TryFrom<&str> for LanguageCode
impl TryFrom<&str> for LanguageCode
Source§impl TryFrom<String> for LanguageCode
impl TryFrom<String> for LanguageCode
impl Eq for LanguageCode
impl StructuralPartialEq for LanguageCode
Auto Trait Implementations§
impl Freeze for LanguageCode
impl RefUnwindSafe for LanguageCode
impl Send for LanguageCode
impl Sync for LanguageCode
impl Unpin for LanguageCode
impl UnsafeUnpin for LanguageCode
impl UnwindSafe for LanguageCode
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