#[derive(Default, Debug, Clone)]
pub struct SimplisticExampleOfConversion<U: Unit>
{
pub em: U::Number,
pub ex: U::Number,
pub ch: U::Number,
pub rem: U::Number,
pub vw: U::Number,
pub vh: U::Number,
pub vmin: U::Number,
pub vmax: U::Number,
pub one_hundred_percent_in_absolute_units: U::Number,
pub cssVariablesWithLowerCaseNamesWithoutLeadingDoubleDashToRawCss: HashMap<String, String>,
pub attributesWithLowerCaseNames: HashMap<String, String>,
}
impl<U: Unit> FontRelativeLengthConversion<U::Number> for SimplisticExampleOfConversion<U>
{
#[inline(always)]
fn em(&self) -> U::Number
{
self.em
}
#[inline(always)]
fn ex(&self) -> U::Number
{
self.ex
}
#[inline(always)]
fn ch(&self) -> U::Number
{
self.ch
}
#[inline(always)]
fn rem(&self) -> U::Number
{
self.rem
}
}
impl<U: Unit> ViewportPercentageLengthConversion<U::Number> for SimplisticExampleOfConversion<U>
{
#[inline(always)]
fn vw(&self) -> U::Number
{
self.vw
}
#[inline(always)]
fn vh(&self) -> U::Number
{
self.vh
}
#[inline(always)]
fn vmin(&self) -> U::Number
{
self.vmin
}
#[inline(always)]
fn vmax(&self) -> U::Number
{
self.vmax
}
}
impl<U: Unit> PercentageConversion<U::Number> for SimplisticExampleOfConversion<U>
{
#[inline(always)]
fn one_hundred_percent_in_absolute_units(&self) -> U::Number
{
self.one_hundred_percent_in_absolute_units
}
}
impl<U: Unit> CssVariableConversion for SimplisticExampleOfConversion<U>
{
#[inline(always)]
fn cssVariableValue(&self, css_variable_lower_case_name_without_leading_double_dash: &str) -> Option<&str>
{
match self.cssVariablesWithLowerCaseNamesWithoutLeadingDoubleDashToRawCss.get(css_variable_lower_case_name_without_leading_double_dash)
{
Some(value) => Some(&value[..]),
None => None,
}
}
}
impl<U: Unit> AttributeConversion<U> for SimplisticExampleOfConversion<U>
{
#[inline(always)]
fn attributeValue(&self, attribute_lower_case_name: &str) -> (Option<&str>, U)
{
match self.attributesWithLowerCaseNames.get(attribute_lower_case_name)
{
Some(value) => (Some(&value[..]), U::default()),
None => (None, U::default()),
}
}
}