micromegas_tracing/
property_value.rs1use std::{borrow::Cow, rc::Rc, sync::Arc};
3
4pub trait PropertyValue {
11 fn property_value(&self) -> Cow<'_, str>;
12}
13
14impl PropertyValue for str {
15 fn property_value(&self) -> Cow<'_, str> {
16 Cow::Borrowed(self)
17 }
18}
19
20impl PropertyValue for String {
21 fn property_value(&self) -> Cow<'_, str> {
22 Cow::Borrowed(self.as_str())
23 }
24}
25
26impl PropertyValue for Cow<'_, str> {
27 fn property_value(&self) -> Cow<'_, str> {
28 Cow::Borrowed(&**self)
29 }
30}
31
32impl<T: PropertyValue + ?Sized> PropertyValue for &T {
33 fn property_value(&self) -> Cow<'_, str> {
34 (**self).property_value()
35 }
36}
37
38impl<T: PropertyValue + ?Sized> PropertyValue for Box<T> {
39 fn property_value(&self) -> Cow<'_, str> {
40 (**self).property_value()
41 }
42}
43
44impl<T: PropertyValue + ?Sized> PropertyValue for Arc<T> {
45 fn property_value(&self) -> Cow<'_, str> {
46 (**self).property_value()
47 }
48}
49
50impl<T: PropertyValue + ?Sized> PropertyValue for Rc<T> {
51 fn property_value(&self) -> Cow<'_, str> {
52 (**self).property_value()
53 }
54}