11use std:: borrow:: Cow ;
22use std:: ops:: { DerefMut , Index } ;
33
4- use firestorm:: profile_method;
54use serde:: de;
65
76use crate :: { de:: PathDeserializer , Resource , ResourcePath } ;
@@ -52,7 +51,6 @@ impl<T: ResourcePath> Path<T> {
5251 /// Returns full path as a string.
5352 #[ inline]
5453 pub fn as_str ( & self ) -> & str {
55- profile_method ! ( as_str) ;
5654 self . path . path ( )
5755 }
5856
@@ -61,7 +59,6 @@ impl<T: ResourcePath> Path<T> {
6159 /// Returns empty string if no more is to be processed.
6260 #[ inline]
6361 pub fn unprocessed ( & self ) -> & str {
64- profile_method ! ( unprocessed) ;
6562 // clamp skip to path length
6663 let skip = ( self . skip as usize ) . min ( self . as_str ( ) . len ( ) ) ;
6764 & self . path . path ( ) [ skip..]
@@ -72,8 +69,6 @@ impl<T: ResourcePath> Path<T> {
7269 #[ deprecated( since = "0.6.0" , note = "Use `.as_str()` or `.unprocessed()`." ) ]
7370 #[ inline]
7471 pub fn path ( & self ) -> & str {
75- profile_method ! ( path) ;
76-
7772 let skip = self . skip as usize ;
7873 let path = self . path . path ( ) ;
7974 if skip <= path. len ( ) {
@@ -86,8 +81,6 @@ impl<T: ResourcePath> Path<T> {
8681 /// Set new path.
8782 #[ inline]
8883 pub fn set ( & mut self , path : T ) {
89- profile_method ! ( set) ;
90-
9184 self . skip = 0 ;
9285 self . path = path;
9386 self . segments . clear ( ) ;
@@ -96,22 +89,17 @@ impl<T: ResourcePath> Path<T> {
9689 /// Reset state.
9790 #[ inline]
9891 pub fn reset ( & mut self ) {
99- profile_method ! ( reset) ;
100-
10192 self . skip = 0 ;
10293 self . segments . clear ( ) ;
10394 }
10495
10596 /// Skip first `n` chars in path.
10697 #[ inline]
10798 pub fn skip ( & mut self , n : u16 ) {
108- profile_method ! ( skip) ;
10999 self . skip += n;
110100 }
111101
112102 pub ( crate ) fn add ( & mut self , name : impl Into < Cow < ' static , str > > , value : PathItem ) {
113- profile_method ! ( add) ;
114-
115103 match value {
116104 PathItem :: Static ( s) => self . segments . push ( ( name. into ( ) , PathItem :: Static ( s) ) ) ,
117105 PathItem :: Segment ( begin, end) => self . segments . push ( (
@@ -127,8 +115,6 @@ impl<T: ResourcePath> Path<T> {
127115 name : impl Into < Cow < ' static , str > > ,
128116 value : impl Into < Cow < ' static , str > > ,
129117 ) {
130- profile_method ! ( add_static) ;
131-
132118 self . segments
133119 . push ( ( name. into ( ) , PathItem :: Static ( value. into ( ) ) ) ) ;
134120 }
@@ -147,8 +133,6 @@ impl<T: ResourcePath> Path<T> {
147133
148134 /// Get matched parameter by name without type conversion
149135 pub fn get ( & self , name : & str ) -> Option < & str > {
150- profile_method ! ( get) ;
151-
152136 for ( seg_name, val) in self . segments . iter ( ) {
153137 if name == seg_name {
154138 return match val {
@@ -167,8 +151,6 @@ impl<T: ResourcePath> Path<T> {
167151 ///
168152 /// If keyed parameter is not available empty string is used as default value.
169153 pub fn query ( & self , key : & str ) -> & str {
170- profile_method ! ( query) ;
171-
172154 if let Some ( s) = self . get ( key) {
173155 s
174156 } else {
@@ -186,7 +168,6 @@ impl<T: ResourcePath> Path<T> {
186168
187169 /// Try to deserialize matching parameters to a specified type `U`
188170 pub fn load < ' de , U : serde:: Deserialize < ' de > > ( & ' de self ) -> Result < U , de:: value:: Error > {
189- profile_method ! ( load) ;
190171 de:: Deserialize :: deserialize ( PathDeserializer :: new ( self ) )
191172 }
192173}
0 commit comments