File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,14 @@ pub struct RawValue {
119119}
120120
121121impl RawValue {
122- fn from_borrowed ( json : & str ) -> & Self {
122+ /// A literal JSON null value as `RawValue`.
123+ pub const NULL : & ' static RawValue = RawValue :: from_borrowed ( "null" ) ;
124+ /// A literal JSON boolean true value as `RawValue`.
125+ pub const TRUE : & ' static RawValue = RawValue :: from_borrowed ( "true" ) ;
126+ /// A literal JSON boolean false value as `RawValue`.
127+ pub const FALSE : & ' static RawValue = RawValue :: from_borrowed ( "false" ) ;
128+
129+ const fn from_borrowed ( json : & str ) -> & Self {
123130 unsafe { mem:: transmute :: < & str , & RawValue > ( json) }
124131 }
125132
@@ -148,7 +155,7 @@ impl ToOwned for RawValue {
148155
149156impl Default for Box < RawValue > {
150157 fn default ( ) -> Self {
151- RawValue :: from_borrowed ( "null" ) . to_owned ( )
158+ RawValue :: NULL . to_owned ( )
152159 }
153160}
154161
You can’t perform that action at this time.
0 commit comments