use crate::components::context::Context;
use crate::context_manager::ContextManager;
pub struct Span
{
_contextId: u64
}
impl Span
{
pub fn new(context: Context) -> Self
{
let id = ContextManager::singleton().add(context);
Self {
_contextId: id
}
}
}
impl Drop for Span
{
fn drop(&mut self) {
ContextManager::singleton().remove(self._contextId);
}
}
#[macro_export]
macro_rules! Spaned
{
() => {
let _span = $crate::components::span::Span::new($crate::components::context::Context::default());
};
($a:expr) => {
let _span = $crate::components::span::Span::new($a.into());
};
}