pub struct SpanTree {
pub nodes: Vec<SpanTreeNode>,
pub roots: Vec<usize>,
}Expand description
Hierarchical reconstruction of spans from parent-child relationships.
Fields§
§nodes: Vec<SpanTreeNode>All nodes in the tree (flat storage, children reference by index).
roots: Vec<usize>Indices of root nodes (spans with no parent or orphaned parents).
Implementations§
Source§impl SpanTree
impl SpanTree
Sourcepub fn build(spans: &[ResourceSpan]) -> Self
pub fn build(spans: &[ResourceSpan]) -> Self
Build a span tree from a flat list of spans.
Uses parent_span_id to establish parent-child relationships.
Spans whose parent is not found in the list become additional roots.
Sourcepub fn total_cost(&self) -> u64
pub fn total_cost(&self) -> u64
Total lease cost across all root subtrees.
Sourcepub fn subtree_cost(&self, idx: usize) -> u64
pub fn subtree_cost(&self, idx: usize) -> u64
Compute the aggregated cost of a subtree rooted at the given node index.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SpanTree
impl RefUnwindSafe for SpanTree
impl Send for SpanTree
impl Sync for SpanTree
impl Unpin for SpanTree
impl UnwindSafe for SpanTree
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