opentracing / opentracing-rust

OpenTracing API for Rust
http://opentracing.io
Apache License 2.0
75 stars 7 forks source link

Add Tags and Fields enums. #8

Closed daschl closed 6 years ago

daschl commented 6 years ago

This changeset adds the tags and fields enums as they are currently represented in the java implementation.

Completes #7

daschl commented 6 years ago

@stefano-pogliani

daschl commented 6 years ago

For completeness I'll also implement FromStr as well as Displayso its easier to convert from and to its textual representation

daschl commented 6 years ago

@stefano-pogliani fleshed out with errors and conversion traits.. its now pretty easy (see unit tests) how to convert and from, so it gives us lots of flexibility on how to use them

daschl commented 6 years ago

@stefano-pogliani which traits do you think we should implement as well? I found derive, and partialeq sufficient - but happy to add more!

stefano-pogliani commented 6 years ago

That is a good question. Personally I am not sure but the rust's lib team is suggesting all of these: Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Display, Default.

Following the philosophy of "Who am I to dismiss the experience of the rust's lib team?" I'd say as many as possible? The Default trait does not make much sense here so I'd skip that but the rest should be derivable.

What do you think @daschl?

daschl commented 6 years ago

@stefano-pogliani added all the tags which I think make sense (also checked with for example std::Result which also implements those, so we can't be too way off here)