pub fn parse_direction<'a>(
input: &'a str,
) -> Result<Direction, CssDirectionParseError<'a>>
Expand description
Parses an direction
such as "50deg"
or "to right bottom"
(in the context of gradients)
ยงExample
use azul_css::DirectionCorner::*;
assert_eq!(parse_direction("to right bottom"), Ok(Direction::FromTo(TopLeft, BottomRight)));
assert_eq!(parse_direction("to right"), Ok(Direction::FromTo(Left, Right)));
assert_eq!(parse_direction("50deg"), Ok(Direction::Angle(FloatValue::new(50.0))));