pub struct TreeTool;Expand description
Tree structure utility wrapper
Implementations§
Source§impl TreeTool
impl TreeTool
pub fn new() -> Self
Sourcepub fn build(
&self,
flat_array: Value,
id_field: &str,
parent_id_field: &str,
children_field: &str,
root_parent_id: Value,
) -> Result<Value>
pub fn build( &self, flat_array: Value, id_field: &str, parent_id_field: &str, children_field: &str, root_parent_id: Value, ) -> Result<Value>
Build a nested tree from a flat JSON array of objects.
flat_array: A JSON array containing flat objects.
id_field: The property name acting as the unique identifier.
parent_id_field: The property name acting as the parent identifier.
children_field: The property name where children will be inserted.
root_parent_id: The parent ID value that identifies root elements (e.g. 0 or null).
Auto Trait Implementations§
impl Freeze for TreeTool
impl RefUnwindSafe for TreeTool
impl Send for TreeTool
impl Sync for TreeTool
impl Unpin for TreeTool
impl UnsafeUnpin for TreeTool
impl UnwindSafe for TreeTool
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