File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,14 @@ pub struct RawValue {
119
119
}
120
120
121
121
impl RawValue {
122
- fn from_borrowed ( json : & str ) -> & Self {
122
+ /// A literal JSON null value as `RawValue`.
123
+ pub const NULL : & RawValue = RawValue :: from_borrowed ( "null" ) ;
124
+ /// A literal JSON boolean true value as `RawValue`.
125
+ pub const TRUE : & RawValue = RawValue :: from_borrowed ( "true" ) ;
126
+ /// A literal JSON boolean false value as `RawValue`.
127
+ pub const FALSE : & RawValue = RawValue :: from_borrowed ( "false" ) ;
128
+
129
+ const fn from_borrowed ( json : & str ) -> & Self {
123
130
unsafe { mem:: transmute :: < & str , & RawValue > ( json) }
124
131
}
125
132
@@ -148,7 +155,7 @@ impl ToOwned for RawValue {
148
155
149
156
impl Default for Box < RawValue > {
150
157
fn default ( ) -> Self {
151
- RawValue :: from_borrowed ( "null" ) . to_owned ( )
158
+ RawValue :: NULL . to_owned ( )
152
159
}
153
160
}
154
161
You can’t perform that action at this time.
0 commit comments