@@ -251,6 +251,42 @@ impl Url {
251
251
let input_with_0_terminate = std:: ffi:: CString :: new ( input. as_ref ( ) ) . unwrap ( ) ;
252
252
unsafe { ffi:: ada_set_protocol ( self . url , input_with_0_terminate. as_ptr ( ) ) }
253
253
}
254
+
255
+ pub fn has_credentials ( & self ) -> bool {
256
+ unsafe { ffi:: ada_has_credentials ( self . url ) }
257
+ }
258
+
259
+ pub fn has_empty_hostname ( & self ) -> bool {
260
+ unsafe { ffi:: ada_has_empty_hostname ( self . url ) }
261
+ }
262
+
263
+ pub fn has_hostname ( & self ) -> bool {
264
+ unsafe { ffi:: ada_has_hostname ( self . url ) }
265
+ }
266
+
267
+ pub fn has_non_empty_username ( & self ) -> bool {
268
+ unsafe { ffi:: ada_has_non_empty_username ( self . url ) }
269
+ }
270
+
271
+ pub fn has_non_empty_password ( & self ) -> bool {
272
+ unsafe { ffi:: ada_has_non_empty_password ( self . url ) }
273
+ }
274
+
275
+ pub fn has_port ( & self ) -> bool {
276
+ unsafe { ffi:: ada_has_port ( self . url ) }
277
+ }
278
+
279
+ pub fn has_password ( & self ) -> bool {
280
+ unsafe { ffi:: ada_has_password ( self . url ) }
281
+ }
282
+
283
+ pub fn has_hash ( & self ) -> bool {
284
+ unsafe { ffi:: ada_has_hash ( self . url ) }
285
+ }
286
+
287
+ pub fn has_search ( & self ) -> bool {
288
+ unsafe { ffi:: ada_has_search ( self . url ) }
289
+ }
254
290
}
255
291
256
292
#[ cfg( test) ]
@@ -293,6 +329,13 @@ mod test {
293
329
294
330
out. set_protocol ( "wss" ) ;
295
331
assert_eq ! ( out. protocol( ) , "wss:" ) ;
332
+
333
+ assert ! ( out. has_credentials( ) ) ;
334
+ assert ! ( out. has_non_empty_username( ) ) ;
335
+ assert ! ( out. has_non_empty_password( ) ) ;
336
+ assert ! ( out. has_search( ) ) ;
337
+ assert ! ( out. has_hash( ) ) ;
338
+ assert ! ( out. has_password( ) ) ;
296
339
}
297
340
298
341
#[ test]
0 commit comments