css_parse/traits/
to_number_value.rs

1pub trait ToNumberValue {
2	fn to_number_value(&self) -> Option<f32>;
3
4	fn to_int_value(&self) -> Option<i32> {
5		self.to_number_value().map(|f| f as i32)
6	}
7}
8
9impl<T: ToNumberValue> ToNumberValue for Option<T> {
10	fn to_number_value(&self) -> Option<f32> {
11		self.as_ref().and_then(|t| t.to_number_value())
12	}
13}