File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,13 @@ impl Identifier {
1515 }
1616}
1717
18+ impl Identifier {
19+ #[ inline]
20+ pub fn as_str ( & self ) -> & str {
21+ self . 0 . as_str ( )
22+ }
23+ }
24+
1825impl std:: cmp:: PartialEq < str > for Identifier {
1926 #[ inline]
2027 fn eq ( & self , other : & str ) -> bool {
@@ -30,9 +37,23 @@ impl std::cmp::PartialEq<String> for Identifier {
3037}
3138
3239impl std:: ops:: Deref for Identifier {
33- type Target = String ;
40+ type Target = str ;
3441 #[ inline]
3542 fn deref ( & self ) -> & Self :: Target {
43+ self . 0 . as_str ( )
44+ }
45+ }
46+
47+ impl AsRef < str > for Identifier {
48+ #[ inline]
49+ fn as_ref ( & self ) -> & str {
50+ self . 0 . as_str ( )
51+ }
52+ }
53+
54+ impl AsRef < String > for Identifier {
55+ #[ inline]
56+ fn as_ref ( & self ) -> & String {
3657 & self . 0
3758 }
3859}
You can’t perform that action at this time.
0 commit comments