@@ -57,6 +57,31 @@ use serde_json::{
57
57
58
58
pub use crate :: errors:: PatchError ;
59
59
60
+ pub mod prelude {
61
+ pub use super :: {
62
+ add_operation,
63
+ copy_operation,
64
+ escape,
65
+ format_ptr,
66
+ move_operation,
67
+ patch_ext,
68
+ remove_operation,
69
+ replace_operation,
70
+ test_operation,
71
+ AddOperation ,
72
+ CopyOperation ,
73
+ MoveOperation ,
74
+ Patch ,
75
+ PatchError ,
76
+ PatchOperation ,
77
+ Pointer ,
78
+ PointerBuf ,
79
+ RemoveOperation ,
80
+ ReplaceOperation ,
81
+ TestOperation ,
82
+ } ;
83
+ }
84
+
60
85
// PatchMode controls what to do if the referenced element does not exist in the object.
61
86
#[ derive( Debug , Clone , Copy ) ]
62
87
enum PatchMode {
@@ -69,20 +94,20 @@ pub fn add_operation(path: PointerBuf, value: Value) -> PatchOperation {
69
94
PatchOperation :: Add ( AddOperation { path, value } )
70
95
}
71
96
72
- pub fn replace_operation ( path : PointerBuf , value : Value ) -> PatchOperation {
73
- PatchOperation :: Replace ( ReplaceOperation { path, value } )
74
- }
75
-
76
- pub fn remove_operation ( path : PointerBuf ) -> PatchOperation {
77
- PatchOperation :: Remove ( RemoveOperation { path } )
97
+ pub fn copy_operation ( from : PointerBuf , path : PointerBuf ) -> PatchOperation {
98
+ PatchOperation :: Copy ( CopyOperation { from, path } )
78
99
}
79
100
80
101
pub fn move_operation ( from : PointerBuf , path : PointerBuf ) -> PatchOperation {
81
102
PatchOperation :: Move ( MoveOperation { from, path } )
82
103
}
83
104
84
- pub fn copy_operation ( from : PointerBuf , path : PointerBuf ) -> PatchOperation {
85
- PatchOperation :: Copy ( CopyOperation { from, path } )
105
+ pub fn remove_operation ( path : PointerBuf ) -> PatchOperation {
106
+ PatchOperation :: Remove ( RemoveOperation { path } )
107
+ }
108
+
109
+ pub fn replace_operation ( path : PointerBuf , value : Value ) -> PatchOperation {
110
+ PatchOperation :: Replace ( ReplaceOperation { path, value } )
86
111
}
87
112
88
113
pub fn test_operation ( path : PointerBuf , value : Value ) -> PatchOperation {
0 commit comments