pub struct Span<'a> { /* private fields */ }Expand description
A live span within a trace.
When end() is called, the span data is pushed into the parent trace’s
span list. The span uses a reference to the trace for this purpose.
Implementations§
Source§impl<'a> Span<'a>
impl<'a> Span<'a>
Sourcepub fn new(
trace: &'a Trace,
span_type: SpanType,
name: impl Into<String>,
) -> Self
pub fn new( trace: &'a Trace, span_type: SpanType, name: impl Into<String>, ) -> Self
Create a new span attached to the given trace.
pub fn model(self, model: impl Into<String>) -> Self
pub fn provider(self, provider: impl Into<String>) -> Self
pub fn input_text(self, input: impl Into<String>) -> Self
pub fn parent(self, parent_id: impl Into<String>) -> Self
pub fn set_tokens(&mut self, input: i64, output: i64)
pub fn set_cost(&mut self, cost: f64)
pub fn set_latency(&mut self, ms: i64)
pub fn set_output(&mut self, output: impl Into<String>)
pub fn set_error(&mut self, message: impl Into<String>)
pub fn set_time_to_first_token(&mut self, ms: i64)
Auto Trait Implementations§
impl<'a> Freeze for Span<'a>
impl<'a> RefUnwindSafe for Span<'a>
impl<'a> Send for Span<'a>
impl<'a> Sync for Span<'a>
impl<'a> Unpin for Span<'a>
impl<'a> UnwindSafe for Span<'a>
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