|
|
@ -1,4 +1,5 @@
|
|
|
|
use super::SVGUnit;
|
|
|
|
use super::SVGUnit;
|
|
|
|
|
|
|
|
use std::cmp::Ordering;
|
|
|
|
use std::fmt;
|
|
|
|
use std::fmt;
|
|
|
|
use std::{
|
|
|
|
use std::{
|
|
|
|
fmt::Display,
|
|
|
|
fmt::Display,
|
|
|
@ -40,6 +41,18 @@ impl PartialEq for SVGMeasure {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl PartialOrd for SVGMeasure {
|
|
|
|
|
|
|
|
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
|
|
|
|
|
|
|
Some(if self == other {
|
|
|
|
|
|
|
|
Ordering::Equal
|
|
|
|
|
|
|
|
} else if self.to_user_units() > other.to_user_units() {
|
|
|
|
|
|
|
|
Ordering::Greater
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Ordering::Less
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl Display for SVGMeasure {
|
|
|
|
impl Display for SVGMeasure {
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
|
|
write!(f, "{}{}", self.measure, self.unit)
|
|
|
|
write!(f, "{}{}", self.measure, self.unit)
|
|
|
|