Struct components::Units [−][src]
pub struct Units(_);
Implementations
impl Units
[src]
impl Units
[src]pub fn get_unit_type(&self) -> UnitType
[src]
pub fn get_unit_value(&self) -> f32
[src]
pub fn to_pixels(&mut self) -> f32
[src]
pub fn from_cm(cm: f32) -> Units
[src]
pub fn from_em(em: f32) -> Units
[src]
Stores a value in em inside units
, using the default font
name as returned by Backend::get_font_name
units
a Units
em
em
pub fn from_em_for_font(font_name: Option<&str>, em: f32) -> Units
[src]
Stores a value in em inside units
using font_name
units
a Units
font_name
the font name and size
em
em
pub fn from_mm(mm: f32) -> Units
[src]
pub fn from_pixels(px: i32) -> Units
[src]
pub fn from_pt(pt: f32) -> Units
[src]
pub fn from_string(str: &str) -> Option<Units>
[src]
Parses a value and updates units
with it
A Units
expressed in string should match:
units: wsp* unit-value wsp* unit-name? wsp*
unit-value: number
unit-name: 'px' | 'pt' | 'mm' | 'em' | 'cm'
number: digit+
| digit* sep digit+
sep: '.' | ','
digit: '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
wsp: (#0x20 | #0x9 | #0xA | #0xB | #0xC | #0xD)+
For instance, these are valid strings:
10 px
5.1 em
24 pt
12.6 mm
.3 cm
While these are not:
42 cats
omg!1!ponies
If no unit is specified, pixels are assumed.
units
a Units
str
the string to convert
Returns
true
if the string was successfully parsed,
and false
otherwise
Trait Implementations
impl PartialOrd<Units> for Units
[src]
impl PartialOrd<Units> for Units
[src]impl StaticType for Units
[src]
impl StaticType for Units
[src]pub fn static_type() -> Type
[src]
impl StructuralEq for Units
[src]
impl StructuralEq for Units
[src]impl StructuralPartialEq for Units
[src]
impl StructuralPartialEq for Units
[src]Auto Trait Implementations
impl RefUnwindSafe for Units
impl RefUnwindSafe for Units
impl UnwindSafe for Units
impl UnwindSafe for Units
Blanket Implementations
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
pub fn into_color(self) -> To
impl<T> ToSendValue for T where
T: SetValue + Send + ToValue + ?Sized,
[src]
impl<T> ToSendValue for T where
T: SetValue + Send + ToValue + ?Sized,
[src]pub fn to_send_value(&self) -> SendValue
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,