@@ -156,7 +156,13 @@ impl Client {
156156 self
157157 }
158158
159- pub fn request ( & self , method : & str , path : & str , data : Option < Map < String , Value > > ) -> Result < HttpResponse , RvError > {
159+ pub fn request < S : Into < String > > (
160+ & self ,
161+ method : & str ,
162+ path : S ,
163+ data : Option < Map < String , Value > > ,
164+ ) -> Result < HttpResponse , RvError > {
165+ let path = path. into ( ) ;
160166 let url = if path. starts_with ( '/' ) {
161167 format ! ( "{}{}" , self . address, path)
162168 } else {
@@ -199,27 +205,39 @@ impl Client {
199205 }
200206 }
201207
202- pub fn request_list ( & self , path : & str ) -> Result < HttpResponse , RvError > {
208+ pub fn request_list < S : Into < String > > ( & self , path : S ) -> Result < HttpResponse , RvError > {
203209 self . request ( "LIST" , path, None )
204210 }
205211
206- pub fn request_read ( & self , path : & str ) -> Result < HttpResponse , RvError > {
212+ pub fn request_read < S : Into < String > > ( & self , path : S ) -> Result < HttpResponse , RvError > {
207213 self . request ( "GET" , path, None )
208214 }
209215
210- pub fn request_get ( & self , path : & str ) -> Result < HttpResponse , RvError > {
216+ pub fn request_get < S : Into < String > > ( & self , path : S ) -> Result < HttpResponse , RvError > {
211217 self . request ( "GET" , path, None )
212218 }
213219
214- pub fn request_write ( & self , path : & str , data : Option < Map < String , Value > > ) -> Result < HttpResponse , RvError > {
220+ pub fn request_write < S : Into < String > > (
221+ & self ,
222+ path : S ,
223+ data : Option < Map < String , Value > > ,
224+ ) -> Result < HttpResponse , RvError > {
215225 self . request ( "POST" , path, data)
216226 }
217227
218- pub fn request_put ( & self , path : & str , data : Option < Map < String , Value > > ) -> Result < HttpResponse , RvError > {
228+ pub fn request_put < S : Into < String > > (
229+ & self ,
230+ path : S ,
231+ data : Option < Map < String , Value > > ,
232+ ) -> Result < HttpResponse , RvError > {
219233 self . request ( "PUT" , path, data)
220234 }
221235
222- pub fn request_delete ( & self , path : & str , data : Option < Map < String , Value > > ) -> Result < HttpResponse , RvError > {
236+ pub fn request_delete < S : Into < String > > (
237+ & self ,
238+ path : S ,
239+ data : Option < Map < String , Value > > ,
240+ ) -> Result < HttpResponse , RvError > {
223241 self . request ( "DELETE" , path, data)
224242 }
225243}
0 commit comments