Enum rsvg::cond::SystemLanguage
source · pub enum SystemLanguage {
Valid(LanguageTags),
Invalid,
}
Expand description
The systemLanguage attribute inside <cond>
element’s children.
Parsing the value of a systemLanguage
attribute may fail if the document supplies
invalid BCP47 language tags. In that case, we store an Invalid
variant.
That variant is used later, during SystemLanguage::eval
, to see whether the
<cond>
should match or not.
Variants§
Valid(LanguageTags)
Invalid
Implementations§
source§impl SystemLanguage
impl SystemLanguage
sourcepub fn from_attribute(s: &str, session: &Session) -> SystemLanguage
pub fn from_attribute(s: &str, session: &Session) -> SystemLanguage
Parse a systemLanguage
attribute and match it against a given Locale
The systemLanguage
conditional attribute is a
comma-separated list of BCP47 Language Tags. This function
parses the attribute and matches the result against a given
locale
. If there is a match, i.e. if the given locale
supports one of the languages listed in the systemLanguage
attribute, then the SystemLanguage.0
will be true
;
otherwise it will be false
.
Normally, calling code will pass &Locale::current()
for the
locale
attribute; this is the user’s current locale.
sourcepub fn eval(&self, user_language: &UserLanguage) -> bool
pub fn eval(&self, user_language: &UserLanguage) -> bool
Evaluate a systemLanguage value for conditional processing.
Trait Implementations§
source§impl Debug for SystemLanguage
impl Debug for SystemLanguage
source§impl PartialEq for SystemLanguage
impl PartialEq for SystemLanguage
source§fn eq(&self, other: &SystemLanguage) -> bool
fn eq(&self, other: &SystemLanguage) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for SystemLanguage
Auto Trait Implementations§
impl Freeze for SystemLanguage
impl RefUnwindSafe for SystemLanguage
impl Send for SystemLanguage
impl Sync for SystemLanguage
impl Unpin for SystemLanguage
impl UnwindSafe for SystemLanguage
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.