blob: 586e471e3829275a9575d53508d36c156be05011 [file] [log] [blame]
David Tolnay55337722016-09-11 12:58:56 -07001use Ident;
2
3pub trait ToIdent {
4 fn to_ident(&self) -> Ident;
5}
6
7impl ToIdent for Ident {
8 fn to_ident(&self) -> Ident {
9 self.clone()
10 }
11}
12
13impl<'a> ToIdent for &'a str {
14 fn to_ident(&self) -> Ident {
15 (**self).into()
16 }
17}
18
19impl ToIdent for String {
20 fn to_ident(&self) -> Ident {
21 self.clone().into()
22 }
23}
24
25impl<'a, T> ToIdent for &'a T where T: ToIdent {
26 fn to_ident(&self) -> Ident {
27 (**self).to_ident()
28 }
29}
30
31impl<'a, T> ToIdent for &'a mut T where T: ToIdent {
32 fn to_ident(&self) -> Ident {
33 (**self).to_ident()
34 }
35}