@@ -14,53 +14,8 @@ use std::fmt;
1414use std:: fmt:: Debug ;
1515use std:: hash:: Hash ;
1616use std:: marker:: PhantomData ;
17- use std:: str:: FromStr ;
1817use tinybytes:: { Bytes , BytesString } ;
1918
20- #[ derive( Debug , PartialEq ) ]
21- pub enum SpanKey {
22- Service ,
23- Name ,
24- Resource ,
25- TraceId ,
26- SpanId ,
27- ParentId ,
28- Start ,
29- Duration ,
30- Error ,
31- Meta ,
32- Metrics ,
33- Type ,
34- MetaStruct ,
35- SpanLinks ,
36- SpanEvents ,
37- }
38-
39- impl FromStr for SpanKey {
40- type Err = SpanKeyParseError ;
41-
42- fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
43- match s {
44- "service" => Ok ( SpanKey :: Service ) ,
45- "name" => Ok ( SpanKey :: Name ) ,
46- "resource" => Ok ( SpanKey :: Resource ) ,
47- "trace_id" => Ok ( SpanKey :: TraceId ) ,
48- "span_id" => Ok ( SpanKey :: SpanId ) ,
49- "parent_id" => Ok ( SpanKey :: ParentId ) ,
50- "start" => Ok ( SpanKey :: Start ) ,
51- "duration" => Ok ( SpanKey :: Duration ) ,
52- "error" => Ok ( SpanKey :: Error ) ,
53- "meta" => Ok ( SpanKey :: Meta ) ,
54- "metrics" => Ok ( SpanKey :: Metrics ) ,
55- "type" => Ok ( SpanKey :: Type ) ,
56- "meta_struct" => Ok ( SpanKey :: MetaStruct ) ,
57- "span_links" => Ok ( SpanKey :: SpanLinks ) ,
58- "span_events" => Ok ( SpanKey :: SpanEvents ) ,
59- _ => Err ( SpanKeyParseError :: new ( format ! ( "Invalid span key: {s}" ) ) ) ,
60- }
61- }
62- }
63-
6419/// Trait representing the requirements for a type to be used as a Span "string" type.
6520/// Note: Borrow<str> is not required by the derived traits, but allows to access HashMap elements
6621/// from a static str and check if the string is empty.
0 commit comments