pub struct TreeNode<M> {
pub node: M,
pub depth: usize,
pub children: Vec<TreeNode<M>>,
}Expand description
A node with its children, built by IntoTree::into_tree. It serializes as the model’s own
fields plus depth and children, ready for a JSON API or a template:
{ "id": 1, "name": "Shop", "depth": 0, "children": [{ "id": 2, "name": "Phones", ... }] }Fields§
§node: MThe node.
depth: usizeThe node’s depth in the built tree: 0 for the nodes at its top.
children: Vec<TreeNode<M>>The node’s children, in the order the list had them.
Trait Implementations§
Auto Trait Implementations§
impl<M> Forget for TreeNode<M>
impl<M> Freeze for TreeNode<M>
impl<M> Move for TreeNode<M>
impl<M> RefUnwindSafe for TreeNode<M>where
M: RefUnwindSafe,
impl<M> Send for TreeNode<M>
impl<M> Sync for TreeNode<M>
impl<M> Unpin for TreeNode<M>
impl<M> UnsafeUnpin for TreeNode<M>
impl<M> UnwindSafe for TreeNode<M>where
M: UnwindSafe,
RawVecInner: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<K> ForeignKey<K> for K
impl<K> ForeignKey<K> for K
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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 moreSource§impl<T> IntoViewData for Twhere
T: Serialize,
impl<T> IntoViewData for Twhere
T: Serialize,
Source§fn into_view_data(self) -> ViewData
fn into_view_data(self) -> ViewData
Converts the value into view data.