pub struct Component {
pub id: String,
pub name: String,
pub parent_id: Option<String>,
pub children: Vec<String>,
pub start_time: Instant,
pub end_time: Option<Instant>,
pub status: ComponentStatus,
pub metadata: ComponentMetadata,
}
Expand description
A tracked component with timing, status, and hierarchical relationships.
Components automatically track their execution time and can be organized in parent-child hierarchies for visualization.
Fields§
§id: String
§name: String
§parent_id: Option<String>
§children: Vec<String>
§start_time: Instant
§end_time: Option<Instant>
§status: ComponentStatus
§metadata: ComponentMetadata
Implementations§
Source§impl Component
impl Component
Sourcepub fn new(id: String, name: String, parent_id: Option<String>) -> Self
pub fn new(id: String, name: String, parent_id: Option<String>) -> Self
Creates a new component with the given ID, name, and optional parent.
Sourcepub fn duration(&self) -> Option<Duration>
pub fn duration(&self) -> Option<Duration>
Returns the duration of component execution, if completed.
Sourcepub fn complete(&mut self, status: ComponentStatus)
pub fn complete(&mut self, status: ComponentStatus)
Marks the component as completed with the given status.
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Returns true
if the component is currently running.
Sourcepub fn to_serializable(&self) -> SerializableComponent
pub fn to_serializable(&self) -> SerializableComponent
Converts this component to a serializable representation.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Component
impl RefUnwindSafe for Component
impl Send for Component
impl Sync for Component
impl Unpin for Component
impl UnwindSafe for Component
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