@@ -3,23 +3,23 @@ use std::sync::LazyLock;
33use symphonia:: core:: meta:: StandardTagKey ;
44
55pub trait CanonicalTagKey {
6- fn canonical_tag_key ( & self ) -> & str ;
6+ fn canonical_tag_key ( & self ) -> String ;
77}
88
99static NONSTANDARD_TAG_MAPPING : LazyLock < HashMap < String , String > > = LazyLock :: new ( || {
1010 serde_json:: from_str ( include_str ! ( "tag_key_mapping.json" ) )
1111 . expect ( "Failed to parse tag mapping." )
1212} ) ;
1313impl CanonicalTagKey for str {
14- fn canonical_tag_key ( & self ) -> & str {
14+ fn canonical_tag_key ( & self ) -> String {
1515 NONSTANDARD_TAG_MAPPING
1616 . get ( self )
17- . map_or ( self , |s| s. as_str ( ) )
17+ . map_or ( self . to_string ( ) , |s| s. clone ( ) )
1818 }
1919}
2020
2121impl CanonicalTagKey for StandardTagKey {
22- fn canonical_tag_key ( & self ) -> & str {
22+ fn canonical_tag_key ( & self ) -> String {
2323 match self {
2424 StandardTagKey :: AcoustidFingerprint => "AcoustidFingerprint" ,
2525 StandardTagKey :: AcoustidId => "AcoustidId" ,
@@ -133,5 +133,6 @@ impl CanonicalTagKey for StandardTagKey {
133133 StandardTagKey :: Version => "Version" ,
134134 StandardTagKey :: Writer => "Writer" ,
135135 }
136+ . to_string ( )
136137 }
137138}
0 commit comments