pub struct PatchOps(/* private fields */);
Expand description
Multiple patch operations
Implementations§
Source§impl PatchOps
impl PatchOps
Sourcepub fn add<T>(self, path: &str, value: T) -> Selfwhere
T: Serialize,
pub fn add<T>(self, path: &str, value: T) -> Selfwhere
T: Serialize,
Adds a value to an object or inserts it into an array.
In the case of an array, the value is inserted before the given index.
The -
character can be used instead of an index to insert at the end of an array.
§Examples
PatchOps::new().add("/biscuits/1", json!({ "name": "Ginger Nut" }))
Sourcepub fn remove(self, path: &str) -> Self
pub fn remove(self, path: &str) -> Self
Removes a value from an object or array.
§Examples
PatchOps::new().remove("/biscuits")
Remove the first element of the array at biscuits
(or just removes the “0” key if biscuits
is an object)
PatchOps::new().remove("/biscuits/0")
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PatchOps
impl RefUnwindSafe for PatchOps
impl Send for PatchOps
impl Sync for PatchOps
impl Unpin for PatchOps
impl UnwindSafe for PatchOps
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more