opentelemetry_sdk/trace/
links.rs

1//! # Span Links
2
3use std::ops::Deref;
4
5use opentelemetry::trace::Link;
6/// Stores span links along with dropped count.
7#[derive(Clone, Debug, Default, PartialEq)]
8#[non_exhaustive]
9pub struct SpanLinks {
10    /// The links stored as a vector. Could be empty if there are no links.
11    pub links: Vec<Link>,
12    /// The number of links dropped from the span.
13    pub dropped_count: u32,
14}
15
16impl Deref for SpanLinks {
17    type Target = [Link];
18
19    fn deref(&self) -> &Self::Target {
20        &self.links
21    }
22}
23
24impl IntoIterator for SpanLinks {
25    type Item = Link;
26    type IntoIter = std::vec::IntoIter<Self::Item>;
27
28    fn into_iter(self) -> Self::IntoIter {
29        self.links.into_iter()
30    }
31}
32
33impl SpanLinks {
34    pub(crate) fn add_link(&mut self, link: Link) {
35        self.links.push(link);
36    }
37}