Struct json_ld::LangString
source · [−]pub struct LangString<J: Json> { /* private fields */ }
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: LiteralString<J>,
language: Option<LenientLanguageTagBuf>,
direction: Option<Direction>
) -> Result<Self, LiteralString<J>>
pub fn new(
str: LiteralString<J>,
language: Option<LenientLanguageTagBuf>,
direction: Option<Direction>
) -> Result<Self, LiteralString<J>>
Create a new language string.
Reference to the underlying str
.
Gets the associated language tag, if any.
pub fn set_language(
&mut self,
language: Option<LenientLanguageTagBuf>
) -> Result<(), InvalidLangString>
pub fn set_language(
&mut self,
language: Option<LenientLanguageTagBuf>
) -> 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<LenientLanguageTagBuf>,
direction: Option<Direction>
) -> Result<(), InvalidLangString>
pub fn set(
&mut self,
language: Option<LenientLanguageTagBuf>,
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
Auto Trait Implementations
impl<J> RefUnwindSafe for LangString<J> where
<J as Json>::String: RefUnwindSafe,
impl<J> Send for LangString<J> where
<J as Json>::String: Send,
impl<J> Sync for LangString<J> where
<J as Json>::String: Sync,
impl<J> Unpin for LangString<J> where
<J as Json>::String: Unpin,
impl<J> UnwindSafe for LangString<J> where
<J as Json>::String: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more