pub struct BatchTree<A: Adapter> { /* private fields */ }Expand description
A batch collector for aggregating and optimizing multiple mutations.
BatchTree is used internally to collect multiple mutations and optimize them before creating
the final mutation. It can merge consecutive append operations and eliminate redundant
mutations.
§Example
use morphix::{BatchTree, JsonAdapter, Mutation, MutationKind};
use serde_json::json;
let mut batch = BatchTree::<JsonAdapter>::new();
// Load multiple mutations
batch.load(Mutation {
path: vec!["field".into()].into(),
kind: MutationKind::Replace(json!(1)),
}).unwrap();
// Dump optimized mutations
let optimized = batch.dump();Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<A> Freeze for BatchTree<A>
impl<A> RefUnwindSafe for BatchTree<A>
impl<A> Send for BatchTree<A>
impl<A> Sync for BatchTree<A>
impl<A> Unpin for BatchTree<A>
impl<A> UnwindSafe for BatchTree<A>
Blanket Implementations§
Source§impl<T> AsDerefCoinductive<Zero> for Twhere
T: ?Sized,
impl<T> AsDerefCoinductive<Zero> for Twhere
T: ?Sized,
Source§impl<T> AsDerefMut<Zero> for Twhere
T: ?Sized,
impl<T> AsDerefMut<Zero> for Twhere
T: ?Sized,
Source§fn as_deref_mut(&mut self) -> &mut T
fn as_deref_mut(&mut self) -> &mut T
Mutably dereferences self
N times.Source§impl<T> AsDerefMutCoinductive<Zero> for Twhere
T: ?Sized,
impl<T> AsDerefMutCoinductive<Zero> for Twhere
T: ?Sized,
Source§fn as_deref_mut_coinductive(&mut self) -> &mut T
fn as_deref_mut_coinductive(&mut self) -> &mut T
Mutably dereferences self
N times.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