summaryrefslogtreecommitdiff
path: root/src/values/pixels.rs
blob: b2b00471e27624f6f44749d1265a4d96e0254d02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::num::ParseFloatError;
use std::str::FromStr;

use iced::Pixels;

use super::Value;

impl Value for Pixels {
    type Err = ParseFloatError;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        Ok(Pixels(f32::from_str(s.trim())?))
    }

    fn to_string(&self) -> String {
        self.0.to_string()
    }
}