Skip to main content

gd_levels/
property_types.rs

1pub trait PropertyValueType {
2    fn to_object_string(&self) -> String;
3}
4
5impl PropertyValueType for String {
6    fn to_object_string(&self) -> String {
7        self.clone()
8    }
9}
10
11impl PropertyValueType for i32 {
12    fn to_object_string(&self) -> String {
13        self.to_string()
14    }
15}
16
17impl PropertyValueType for f64 {
18    fn to_object_string(&self) -> String {
19        self.to_string()
20    }
21}
22
23impl PropertyValueType for bool {
24    fn to_object_string(&self) -> String {
25        if *self {
26            String::from("1")
27        } else {
28            String::from("0")
29        }
30    }
31}