@@ -47,33 +47,33 @@ impl Display for Value {
47
47
}
48
48
}
49
49
50
- struct TargetSpec ( Object ) ;
51
-
52
- impl TargetSpec {
53
- fn new ( ) -> TargetSpec {
54
- TargetSpec ( Vec :: new ( ) )
50
+ impl From < bool > for Value {
51
+ fn from ( value : bool ) -> Self {
52
+ Self :: Boolean ( value)
55
53
}
56
54
}
57
55
58
- trait Push < T > {
59
- fn push ( & mut self , key : & str , value : T ) ;
56
+ impl From < i32 > for Value {
57
+ fn from ( value : i32 ) -> Self {
58
+ Self :: Number ( value)
59
+ }
60
60
}
61
61
62
- impl Push < bool > for TargetSpec {
63
- fn push ( & mut self , key : & str , value : bool ) {
64
- self . 0 . push ( ( key . to_string ( ) , Value :: Boolean ( value) ) ) ;
62
+ impl From < String > for Value {
63
+ fn from ( value : String ) -> Self {
64
+ Self :: String ( value)
65
65
}
66
66
}
67
67
68
- impl Push < i32 > for TargetSpec {
69
- fn push ( & mut self , key : & str , value : i32 ) {
70
- self . 0 . push ( ( key . to_string ( ) , Value :: Number ( value ) ) ) ;
68
+ impl From < & str > for Value {
69
+ fn from ( value : & str ) -> Self {
70
+ Self :: String ( value . to_string ( ) )
71
71
}
72
72
}
73
73
74
- impl Push < String > for TargetSpec {
75
- fn push ( & mut self , key : & str , value : String ) {
76
- self . 0 . push ( ( key . to_string ( ) , Value :: String ( value ) ) ) ;
74
+ impl From < Object > for Value {
75
+ fn from ( object : Object ) -> Self {
76
+ Self :: Object ( object )
77
77
}
78
78
}
79
79
@@ -83,9 +83,15 @@ impl Push<&str> for TargetSpec {
83
83
}
84
84
}
85
85
86
- impl Push < Object > for TargetSpec {
87
- fn push ( & mut self , key : & str , value : Object ) {
88
- self . 0 . push ( ( key. to_string ( ) , Value :: Object ( value) ) ) ;
86
+ struct TargetSpec ( Object ) ;
87
+
88
+ impl TargetSpec {
89
+ fn new ( ) -> TargetSpec {
90
+ TargetSpec ( Vec :: new ( ) )
91
+ }
92
+
93
+ fn push ( & mut self , key : & str , value : impl Into < Value > ) {
94
+ self . 0 . push ( ( key. to_string ( ) , value. into ( ) ) ) ;
89
95
}
90
96
}
91
97
0 commit comments