pub fn parse_length(&mut self) -> Result<Length> {
        self.skip_spaces();

        let n = self.parse_number()?;

        if self.at_end() {
            return Ok(Length::new(n, LengthUnit::None));
        }

        let u = if self.starts_with(b"%") {
            LengthUnit::Percent
        } else if self.starts_with(b"em") {
            LengthUnit::Em
        } else if self.starts_with(b"ex") {
            LengthUnit::Ex
        } else if self.starts_with(b"px") {
            LengthUnit::Px
        } else if self.starts_with(b"in") {
            LengthUnit::In
        } else if self.starts_with(b"cm") {
            LengthUnit::Cm
        } else if self.starts_with(b"mm") {
            LengthUnit::Mm
        } else if self.starts_with(b"pt") {
            LengthUnit::Pt
        } else if self.starts_with(b"pc") {
            LengthUnit::Pc
        } else {
            LengthUnit::None
        };

        match u {
            LengthUnit::Percent => self.advance(1),
            LengthUnit::None => {}
            _ => self.advance(2),
        }

        Ok(Length::new(n, u))
    }
/// Parses length from the stream.
///
/// <https://www.w3.org/TR/SVG11/types.html#DataTypeLength>
///
/// # Examples
///
/// ```
/// use svgtypes::{Stream, Length, LengthUnit};
///
/// let mut s = Stream::from("30%");
/// assert_eq!(s.parse_length().unwrap(), Length::new(30.0, LengthUnit::Percent));
/// ```
///
/// # Notes
///
/// - Suffix must be lowercase, otherwise it will be an error.
Parses length from the stream.
Parses length from the stream .
pub fn parse_length(&mut self) -> Result<Length> {
        self.skip_spaces();
        let n = self.parse_number()?;
        if self.at_end() {
            return Ok(Length::new(n, LengthUnit::None));
        }
        let u = if self.starts_with(b"%") {
            LengthUnit::Percent
        } else if self.starts_with(b"em") {
            LengthUnit::Em
        } else if self.starts_with(b"ex") {
            LengthUnit::Ex
        } else if self.starts_with(b"px") {
            LengthUnit::Px
        } else if self.starts_with(b"in") {
            LengthUnit::In
        } else if self.starts_with(b"cm") {
            LengthUnit::Cm
        } else if self.starts_with(b"mm") {
            LengthUnit::Mm
        } else if self.starts_with(b"pt") {
            LengthUnit::Pt
        } else if self.starts_with(b"pc") {
            LengthUnit::Pc
        } else {
            LengthUnit::None
        };
        match u {
            LengthUnit::Percent => self.advance(1),
            LengthUnit::None => {}
            _ => self.advance(2),
        }
        Ok(Length::new(n, u))
    }
pub fn parse_length ( & mut self ) -> Result < Length > { self . skip_spaces ( ) ; let n = self . parse_number ( ) ? ; if self . at_end ( ) { return Ok ( Length :: new ( n , LengthUnit :: None ) ) ; } let u = if self . starts_with ( b" " ) { LengthUnit :: Percent } else if self . starts_with ( b" " ) { LengthUnit :: Em } else if self . starts_with ( b" " ) { LengthUnit :: Ex } else if self . starts_with ( b" " ) { LengthUnit :: Px } else if self . starts_with ( b" " ) { LengthUnit :: In } else if self . starts_with ( b" " ) { LengthUnit :: Cm } else if self . starts_with ( b" " ) { LengthUnit :: Mm } else if self . starts_with ( b" " ) { LengthUnit :: Pt } else if self . starts_with ( b" " ) { LengthUnit :: Pc } else { LengthUnit :: None } ; match u { LengthUnit :: Percent => self . advance ( 1 ) , LengthUnit :: None => { } _ => self . advance ( 2 ) , } Ok ( Length :: new ( n , u ) ) }
Parses length from the stream.
Parses length from the stream .
&mut self
examples
```
use svgtypes::{Stream, Length, LengthUnit}.


` ` ` use svgtypes :: { Stream Length LengthUnit } .
notes
Suffix must be lowercase, otherwise it will be an error.
Suffix must be lowercase otherwise it will be an error .