diff options
| author | pml68 <contact@pml68.dev> | 2025-02-27 09:21:13 +0100 |
|---|---|---|
| committer | pml68 <contact@pml68.dev> | 2025-02-27 09:21:13 +0100 |
| commit | 2fe98e55188dc2dda4170d5a25551f6c72170e8c (patch) | |
| tree | d07c901254545a9952430a64ed44c6355dc0e07a /src/values/rotation.rs | |
| parent | feat: rework `Value` trait, create unit tests for parser implementations (diff) | |
| download | iced-builder-2fe98e55188dc2dda4170d5a25551f6c72170e8c.tar.gz | |
feat: implement `Value` for `Length`
Diffstat (limited to 'src/values/rotation.rs')
| -rw-r--r-- | src/values/rotation.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/values/rotation.rs b/src/values/rotation.rs index da291b2..2b609d3 100644 --- a/src/values/rotation.rs +++ b/src/values/rotation.rs @@ -25,6 +25,8 @@ impl Value for Rotation { type Err = ParseRotationError; fn from_str(s: &str) -> Result<Self, Self::Err> { + let s = s.trim(); + if s.is_empty() { return Err(ParseRotationError::Empty); } @@ -98,13 +100,13 @@ mod tests { assert_eq!( Rotation::from_str("3.a"), Err(ParseRotationError::ParseFloatError( - f32::from_str("3.a").expect_err("") + f32::from_str("3.a").expect_err("float parse should fail") )) ) } #[test] fn cant_parse_empty_string() { - assert_eq!(Rotation::from_str(""), Err(ParseRotationError::Empty)) + assert_eq!(Rotation::from_str(" "), Err(ParseRotationError::Empty)) } } |
