@@ -21,7 +21,7 @@ pub struct LeetCode {
21
21
22
22
macro_rules! make_req {
23
23
( $self: ident, $url: expr) => {
24
- Req :: new( $self. default_headers, function_name!( ) , $url)
24
+ Req :: new( $self. default_headers. to_owned ( ) , function_name!( ) , $url)
25
25
}
26
26
}
27
27
@@ -74,7 +74,7 @@ impl LeetCode {
74
74
75
75
/// Get category problems
76
76
#[ named]
77
- pub async fn get_category_problems ( self , category : & str ) -> Result < Response , Error > {
77
+ pub async fn get_category_problems ( & self , category : & str ) -> Result < Response , Error > {
78
78
trace ! ( "Requesting {} problems..." , & category) ;
79
79
let url = & self
80
80
. conf
@@ -89,7 +89,7 @@ impl LeetCode {
89
89
}
90
90
91
91
#[ named]
92
- pub async fn get_question_ids_by_tag ( self , slug : & str ) -> Result < Response , Error > {
92
+ pub async fn get_question_ids_by_tag ( & self , slug : & str ) -> Result < Response , Error > {
93
93
trace ! ( "Requesting {} ref problems..." , & slug) ;
94
94
let url = & self . conf . sys . urls . get ( "graphql" ) . ok_or ( Error :: NoneError ) ?;
95
95
let mut json: Json = HashMap :: new ( ) ;
@@ -115,7 +115,7 @@ impl LeetCode {
115
115
}
116
116
117
117
#[ named]
118
- pub async fn get_user_info ( self ) -> Result < Response , Error > {
118
+ pub async fn get_user_info ( & self ) -> Result < Response , Error > {
119
119
let url = & self . conf . sys . urls . get ( "graphql" ) . ok_or ( Error :: NoneError ) ?;
120
120
let mut json: Json = HashMap :: new ( ) ;
121
121
json. insert ( "operationName" , "a" . to_string ( ) ) ;
@@ -138,7 +138,7 @@ impl LeetCode {
138
138
139
139
/// Get daily problem
140
140
#[ named]
141
- pub async fn get_question_daily ( self ) -> Result < Response , Error > {
141
+ pub async fn get_question_daily ( & self ) -> Result < Response , Error > {
142
142
let url = & self . conf . sys . urls . get ( "graphql" ) . ok_or ( Error :: NoneError ) ?;
143
143
let mut json: Json = HashMap :: new ( ) ;
144
144
json. insert ( "operationName" , "daily" . to_string ( ) ) ;
@@ -162,7 +162,7 @@ impl LeetCode {
162
162
163
163
/// Get specific problem detail
164
164
#[ named]
165
- pub async fn get_question_detail ( self , slug : & str ) -> Result < Response , Error > {
165
+ pub async fn get_question_detail ( & self , slug : & str ) -> Result < Response , Error > {
166
166
trace ! ( "Requesting {} detail..." , & slug) ;
167
167
let refer = self . conf . sys . urls . get ( "problems" ) . ok_or ( Error :: NoneError ) ?. replace ( "$slug" , slug) ;
168
168
let url = & self . conf . sys . urls . get ( "graphql" ) . ok_or ( Error :: NoneError ) ?;
@@ -200,7 +200,7 @@ impl LeetCode {
200
200
201
201
/// Send code to judge
202
202
#[ named]
203
- pub async fn run_code ( self , j : Json , url : String , refer : String ) -> Result < Response , Error > {
203
+ pub async fn run_code ( & self , j : Json , url : String , refer : String ) -> Result < Response , Error > {
204
204
let mut req = make_req ! ( self , url) ;
205
205
req. mode = Mode :: Post ( j) ;
206
206
req. refer = Some ( refer) ;
@@ -211,7 +211,7 @@ impl LeetCode {
211
211
212
212
/// Get the result of submission / testing
213
213
#[ named]
214
- pub async fn verify_result ( self , id : String ) -> Result < Response , Error > {
214
+ pub async fn verify_result ( & self , id : String ) -> Result < Response , Error > {
215
215
let url = self . conf . sys . urls . get ( "verify" ) . ok_or ( Error :: NoneError ) ?. replace ( "$id" , & id) ;
216
216
make_req ! ( self , url)
217
217
. send ( & self . client )
0 commit comments