Skip to main content

Edit

Enum Edit 

Source
pub enum Edit<'a> {
    Set(&'a [u8]),
    Remove,
    Put(&'a [u8], &'a [u8]),
    Splice {
        at: usize,
        take: usize,
        put: &'a [&'a [u8]],
    },
}
Expand description

What to do at one place in a document.

Every set of bytes here is an encoded value and not JSON text. The callers are the JSON.* commands, which have parsed their argument with Builder::json by this point, and the ones that compute rather than parse, like JSON.NUMINCRBY, never had text at all.

Variants§

§

Set(&'a [u8])

Put these bytes in place of the value that is here.

§

Remove

Take the value that is here out of whatever holds it.

Removing the root is refused, because a document with no value in it is not a document. JSON.DEL $ deletes the key, which is the keyspace’s business and not this file’s.

§

Put(&'a [u8], &'a [u8])

Put a member under this key into the object that is here.

The key replaces the one already there if there is one, so this is both halves of what JSON.SET does at a path whose last step is a name.

§

Splice

Replace take elements of the array that is here, from at, with put.

at and take are clamped to the array, so an append is at at or past the end with take of zero, and a trim is at of zero with take of the whole length and the kept elements in put.

Fields

§at: usize

Where the replaced run starts.

§take: usize

How many elements it covers.

§put: &'a [&'a [u8]]

What goes in their place.

Trait Implementations§

Source§

impl<'a> Clone for Edit<'a>

Source§

fn clone(&self) -> Edit<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for Edit<'a>

Source§

impl<'a> Debug for Edit<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Edit<'a>

§

impl<'a> RefUnwindSafe for Edit<'a>

§

impl<'a> Send for Edit<'a>

§

impl<'a> Sync for Edit<'a>

§

impl<'a> Unpin for Edit<'a>

§

impl<'a> UnsafeUnpin for Edit<'a>

§

impl<'a> UnwindSafe for Edit<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.