Struct json_ld::LangString [−][src]
pub struct LangString { /* fields omitted */ }
Expand description
Language string.
A language string is a string tagged with language and reading direction information.
A valid language string is associated to either a language tag or a direction, or both.
Implementations
pub fn new(
str: String,
language: Option<LanguageTagBuf>,
direction: Option<Direction>
) -> Result<LangString, String>
pub fn new(
str: String,
language: Option<LanguageTagBuf>,
direction: Option<Direction>
) -> Result<LangString, String>
Create a new language string.
Gets the associated language tag, if any.
pub fn set_language(
&mut self,
language: Option<LanguageTagBuf>
) -> Result<(), InvalidLangString>
pub fn set_language(
&mut self,
language: Option<LanguageTagBuf>
) -> Result<(), InvalidLangString>
Sets the associated language tag.
If None
is given, the direction must be set,
otherwise this function will fail with an InvalidLangString
error.
pub fn set_direction(
&mut self,
direction: Option<Direction>
) -> Result<(), InvalidLangString>
pub fn set_direction(
&mut self,
direction: Option<Direction>
) -> Result<(), InvalidLangString>
Sets the associated direction.
If None
is given, a language tag must be set,
otherwise this function will fail with an InvalidLangString
error.
pub fn set(
&mut self,
language: Option<LanguageTagBuf>,
direction: Option<Direction>
) -> Result<(), InvalidLangString>
pub fn set(
&mut self,
language: Option<LanguageTagBuf>,
direction: Option<Direction>
) -> Result<(), InvalidLangString>
Set both the language tag and direction.
If both language
and direction
are None
,
this function will fail with an InvalidLangString
error.
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for LangString
impl Send for LangString
impl Sync for LangString
impl Unpin for LangString
impl UnwindSafe for LangString
Blanket Implementations
Mutably borrows from an owned value. Read more