1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917
// // DO NOT EDIT. THIS FILE IS GENERATED FROM ../../../dist/idl/mozIAsyncHistory.idl // /// `interface mozIVisitInfo : nsISupports` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct mozIVisitInfo { vtable: *const mozIVisitInfoVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for mozIVisitInfo. unsafe impl XpCom for mozIVisitInfo { const IID: nsIID = nsID(0x41e4ccc9, 0xf0c8, 0x4cd7, [0x97, 0x53, 0x7a, 0x38, 0x51, 0x4b, 0x84, 0x88]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for mozIVisitInfo { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from mozIVisitInfo. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait mozIVisitInfoCoerce { /// Cheaply cast a value of this type from a `mozIVisitInfo`. fn coerce_from(v: &mozIVisitInfo) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl mozIVisitInfoCoerce for mozIVisitInfo { #[inline] fn coerce_from(v: &mozIVisitInfo) -> &Self { v } } impl mozIVisitInfo { /// Cast this `mozIVisitInfo` to one of its base interfaces. #[inline] pub fn coerce<T: mozIVisitInfoCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for mozIVisitInfo { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> mozIVisitInfoCoerce for T { #[inline] fn coerce_from(v: &mozIVisitInfo) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every mozIVisitInfo // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct mozIVisitInfoVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* readonly attribute long long visitId; */ pub GetVisitId: unsafe extern "system" fn (this: *const mozIVisitInfo, aVisitId: *mut libc::int64_t) -> nsresult, /* readonly attribute PRTime visitDate; */ pub GetVisitDate: unsafe extern "system" fn (this: *const mozIVisitInfo, aVisitDate: *mut PRTime) -> nsresult, /* readonly attribute unsigned long transitionType; */ pub GetTransitionType: unsafe extern "system" fn (this: *const mozIVisitInfo, aTransitionType: *mut libc::uint32_t) -> nsresult, /* readonly attribute nsIURI referrerURI; */ pub GetReferrerURI: unsafe extern "system" fn (this: *const mozIVisitInfo, aReferrerURI: *mut *const nsIURI) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl mozIVisitInfo { /// ```text /// /** /// * The machine-local (internal) id of the visit. /// */ /// ``` /// /// `readonly attribute long long visitId;` #[inline] pub unsafe fn GetVisitId(&self, aVisitId: *mut libc::int64_t) -> nsresult { ((*self.vtable).GetVisitId)(self, aVisitId) } /// ```text /// /** /// * The time the visit occurred. /// */ /// ``` /// /// `readonly attribute PRTime visitDate;` #[inline] pub unsafe fn GetVisitDate(&self, aVisitDate: *mut PRTime) -> nsresult { ((*self.vtable).GetVisitDate)(self, aVisitDate) } /// ```text /// /** /// * The transition type used to get to this visit. One of the TRANSITION_TYPE /// * constants on nsINavHistory. /// * /// * @see nsINavHistory.idl /// */ /// ``` /// /// `readonly attribute unsigned long transitionType;` #[inline] pub unsafe fn GetTransitionType(&self, aTransitionType: *mut libc::uint32_t) -> nsresult { ((*self.vtable).GetTransitionType)(self, aTransitionType) } /// ```text /// /** /// * The referring URI of this visit. This may be null. /// */ /// ``` /// /// `readonly attribute nsIURI referrerURI;` #[inline] pub unsafe fn GetReferrerURI(&self, aReferrerURI: *mut *const nsIURI) -> nsresult { ((*self.vtable).GetReferrerURI)(self, aReferrerURI) } } /// `interface mozIPlaceInfo : nsISupports` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct mozIPlaceInfo { vtable: *const mozIPlaceInfoVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for mozIPlaceInfo. unsafe impl XpCom for mozIPlaceInfo { const IID: nsIID = nsID(0xad83e137, 0xc92a, 0x4b7b, [0xb6, 0x7e, 0x0a, 0x31, 0x88, 0x11, 0xf9, 0x1e]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for mozIPlaceInfo { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from mozIPlaceInfo. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait mozIPlaceInfoCoerce { /// Cheaply cast a value of this type from a `mozIPlaceInfo`. fn coerce_from(v: &mozIPlaceInfo) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl mozIPlaceInfoCoerce for mozIPlaceInfo { #[inline] fn coerce_from(v: &mozIPlaceInfo) -> &Self { v } } impl mozIPlaceInfo { /// Cast this `mozIPlaceInfo` to one of its base interfaces. #[inline] pub fn coerce<T: mozIPlaceInfoCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for mozIPlaceInfo { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> mozIPlaceInfoCoerce for T { #[inline] fn coerce_from(v: &mozIPlaceInfo) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every mozIPlaceInfo // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct mozIPlaceInfoVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* readonly attribute long long placeId; */ pub GetPlaceId: unsafe extern "system" fn (this: *const mozIPlaceInfo, aPlaceId: *mut libc::int64_t) -> nsresult, /* readonly attribute ACString guid; */ pub GetGuid: unsafe extern "system" fn (this: *const mozIPlaceInfo, aGuid: &mut ::nsstring::nsACString) -> nsresult, /* readonly attribute nsIURI uri; */ pub GetUri: unsafe extern "system" fn (this: *const mozIPlaceInfo, aUri: *mut *const nsIURI) -> nsresult, /* readonly attribute AString title; */ pub GetTitle: unsafe extern "system" fn (this: *const mozIPlaceInfo, aTitle: &mut ::nsstring::nsAString) -> nsresult, /* readonly attribute long long frecency; */ pub GetFrecency: unsafe extern "system" fn (this: *const mozIPlaceInfo, aFrecency: *mut libc::int64_t) -> nsresult, /* [implicit_jscontext] readonly attribute jsval visits; */ /// Unable to generate binding because `native type JS::Value is unsupported` pub GetVisits: *const ::libc::c_void, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl mozIPlaceInfo { /// ```text /// /** /// * The machine-local (internal) id of the place. /// */ /// ``` /// /// `readonly attribute long long placeId;` #[inline] pub unsafe fn GetPlaceId(&self, aPlaceId: *mut libc::int64_t) -> nsresult { ((*self.vtable).GetPlaceId)(self, aPlaceId) } /// ```text /// /** /// * The globally unique id of the place. /// */ /// ``` /// /// `readonly attribute ACString guid;` #[inline] pub unsafe fn GetGuid(&self, aGuid: &mut ::nsstring::nsACString) -> nsresult { ((*self.vtable).GetGuid)(self, aGuid) } /// ```text /// /** /// * The URI of the place. /// */ /// ``` /// /// `readonly attribute nsIURI uri;` #[inline] pub unsafe fn GetUri(&self, aUri: *mut *const nsIURI) -> nsresult { ((*self.vtable).GetUri)(self, aUri) } /// ```text /// /** /// * The title associated with the place. /// */ /// ``` /// /// `readonly attribute AString title;` #[inline] pub unsafe fn GetTitle(&self, aTitle: &mut ::nsstring::nsAString) -> nsresult { ((*self.vtable).GetTitle)(self, aTitle) } /// ```text /// /** /// * The frecency of the place. /// */ /// ``` /// /// `readonly attribute long long frecency;` #[inline] pub unsafe fn GetFrecency(&self, aFrecency: *mut libc::int64_t) -> nsresult { ((*self.vtable).GetFrecency)(self, aFrecency) } /// ```text /// /** /// * An array of mozIVisitInfo objects for the place. /// */ /// ``` /// /// `[implicit_jscontext] readonly attribute jsval visits;` const _GetVisits: () = (); } /// `interface mozIVisitInfoCallback : nsISupports` /// /// ```text /// /** /// * Shared Callback interface for mozIAsyncHistory methods. The semantics /// * for each method are detailed in mozIAsyncHistory. /// */ /// ``` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct mozIVisitInfoCallback { vtable: *const mozIVisitInfoCallbackVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for mozIVisitInfoCallback. unsafe impl XpCom for mozIVisitInfoCallback { const IID: nsIID = nsID(0x1f266877, 0x2859, 0x418b, [0xa1, 0x1b, 0xec, 0x3a, 0xe4, 0xf4, 0xf9, 0x3d]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for mozIVisitInfoCallback { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from mozIVisitInfoCallback. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait mozIVisitInfoCallbackCoerce { /// Cheaply cast a value of this type from a `mozIVisitInfoCallback`. fn coerce_from(v: &mozIVisitInfoCallback) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl mozIVisitInfoCallbackCoerce for mozIVisitInfoCallback { #[inline] fn coerce_from(v: &mozIVisitInfoCallback) -> &Self { v } } impl mozIVisitInfoCallback { /// Cast this `mozIVisitInfoCallback` to one of its base interfaces. #[inline] pub fn coerce<T: mozIVisitInfoCallbackCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for mozIVisitInfoCallback { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> mozIVisitInfoCallbackCoerce for T { #[inline] fn coerce_from(v: &mozIVisitInfoCallback) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every mozIVisitInfoCallback // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct mozIVisitInfoCallbackVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* void handleError (in nsresult aResultCode, in mozIPlaceInfo aPlaceInfo); */ pub HandleError: unsafe extern "system" fn (this: *const mozIVisitInfoCallback, aResultCode: nsresult, aPlaceInfo: *const mozIPlaceInfo) -> nsresult, /* void handleResult (in mozIPlaceInfo aPlaceInfo); */ pub HandleResult: unsafe extern "system" fn (this: *const mozIVisitInfoCallback, aPlaceInfo: *const mozIPlaceInfo) -> nsresult, /* void handleCompletion (in unsigned long aUpdatedItems); */ pub HandleCompletion: unsafe extern "system" fn (this: *const mozIVisitInfoCallback, aUpdatedItems: libc::uint32_t) -> nsresult, /* readonly attribute bool ignoreResults; */ pub GetIgnoreResults: unsafe extern "system" fn (this: *const mozIVisitInfoCallback, aIgnoreResults: *mut bool) -> nsresult, /* readonly attribute bool ignoreErrors; */ pub GetIgnoreErrors: unsafe extern "system" fn (this: *const mozIVisitInfoCallback, aIgnoreErrors: *mut bool) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl mozIVisitInfoCallback { /// ```text /// /** /// * Called when the given place could not be processed. /// * /// * @param aResultCode /// * nsresult indicating the failure reason. /// * @param aPlaceInfo /// * The information that was given to the caller for the place. /// */ /// ``` /// /// `void handleError (in nsresult aResultCode, in mozIPlaceInfo aPlaceInfo);` #[inline] pub unsafe fn HandleError(&self, aResultCode: nsresult, aPlaceInfo: *const mozIPlaceInfo) -> nsresult { ((*self.vtable).HandleError)(self, aResultCode, aPlaceInfo) } /// ```text /// /** /// * Called for each place processed successfully. /// * /// * @param aPlaceInfo /// * The current info stored for the place. /// */ /// ``` /// /// `void handleResult (in mozIPlaceInfo aPlaceInfo);` #[inline] pub unsafe fn HandleResult(&self, aPlaceInfo: *const mozIPlaceInfo) -> nsresult { ((*self.vtable).HandleResult)(self, aPlaceInfo) } /// ```text /// /** /// * Called when all records were processed. /// * @param aUpdatedItems /// * How many items were successfully updated. /// */ /// ``` /// /// `void handleCompletion (in unsigned long aUpdatedItems);` #[inline] pub unsafe fn HandleCompletion(&self, aUpdatedItems: libc::uint32_t) -> nsresult { ((*self.vtable).HandleCompletion)(self, aUpdatedItems) } /// ```text /// /** /// * These two attributes govern whether we attempt to call /// * handleResult and handleError, respectively, if/once /// * results/errors occur. /// */ /// ``` /// /// `readonly attribute bool ignoreResults;` #[inline] pub unsafe fn GetIgnoreResults(&self, aIgnoreResults: *mut bool) -> nsresult { ((*self.vtable).GetIgnoreResults)(self, aIgnoreResults) } /// `readonly attribute bool ignoreErrors;` #[inline] pub unsafe fn GetIgnoreErrors(&self, aIgnoreErrors: *mut bool) -> nsresult { ((*self.vtable).GetIgnoreErrors)(self, aIgnoreErrors) } } /// `interface mozIVisitedStatusCallback : nsISupports` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct mozIVisitedStatusCallback { vtable: *const mozIVisitedStatusCallbackVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for mozIVisitedStatusCallback. unsafe impl XpCom for mozIVisitedStatusCallback { const IID: nsIID = nsID(0x994092bf, 0x936f, 0x449b, [0x8d, 0xd6, 0x09, 0x41, 0xe0, 0x24, 0x36, 0x0d]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for mozIVisitedStatusCallback { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from mozIVisitedStatusCallback. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait mozIVisitedStatusCallbackCoerce { /// Cheaply cast a value of this type from a `mozIVisitedStatusCallback`. fn coerce_from(v: &mozIVisitedStatusCallback) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl mozIVisitedStatusCallbackCoerce for mozIVisitedStatusCallback { #[inline] fn coerce_from(v: &mozIVisitedStatusCallback) -> &Self { v } } impl mozIVisitedStatusCallback { /// Cast this `mozIVisitedStatusCallback` to one of its base interfaces. #[inline] pub fn coerce<T: mozIVisitedStatusCallbackCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for mozIVisitedStatusCallback { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> mozIVisitedStatusCallbackCoerce for T { #[inline] fn coerce_from(v: &mozIVisitedStatusCallback) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every mozIVisitedStatusCallback // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct mozIVisitedStatusCallbackVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* void isVisited (in nsIURI aURI, in boolean aVisitedStatus); */ pub IsVisited: unsafe extern "system" fn (this: *const mozIVisitedStatusCallback, aURI: *const nsIURI, aVisitedStatus: bool) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl mozIVisitedStatusCallback { /// ```text /// /** /// * Notifies whether a certain URI has been visited. /// * /// * @param aURI /// * URI being notified about. /// * @param aVisitedStatus /// * The visited status of aURI. /// */ /// ``` /// /// `void isVisited (in nsIURI aURI, in boolean aVisitedStatus);` #[inline] pub unsafe fn IsVisited(&self, aURI: *const nsIURI, aVisitedStatus: bool) -> nsresult { ((*self.vtable).IsVisited)(self, aURI, aVisitedStatus) } } /// `interface mozIAsyncHistory : nsISupports` /// /// ```text /// /** /// * This interface contains APIs for cpp consumers. /// * Javascript consumers should look at History.jsm instead, /// * that is exposed through PlacesUtils.history. /// * /// * If you're evaluating adding a new history API, it should /// * usually go to History.jsm, unless it needs to do long and /// * expensive work in a batch, then it could be worth doing /// * that in History.cpp. /// */ /// ``` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct mozIAsyncHistory { vtable: *const mozIAsyncHistoryVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for mozIAsyncHistory. unsafe impl XpCom for mozIAsyncHistory { const IID: nsIID = nsID(0x1643efd2, 0xa329, 0x4733, [0xa3, 0x9d, 0x17, 0x06, 0x9c, 0x8d, 0x3b, 0x2d]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for mozIAsyncHistory { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from mozIAsyncHistory. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait mozIAsyncHistoryCoerce { /// Cheaply cast a value of this type from a `mozIAsyncHistory`. fn coerce_from(v: &mozIAsyncHistory) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl mozIAsyncHistoryCoerce for mozIAsyncHistory { #[inline] fn coerce_from(v: &mozIAsyncHistory) -> &Self { v } } impl mozIAsyncHistory { /// Cast this `mozIAsyncHistory` to one of its base interfaces. #[inline] pub fn coerce<T: mozIAsyncHistoryCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for mozIAsyncHistory { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> mozIAsyncHistoryCoerce for T { #[inline] fn coerce_from(v: &mozIAsyncHistory) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every mozIAsyncHistory // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct mozIAsyncHistoryVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* [implicit_jscontext] void updatePlaces (in jsval aPlaceInfo, [optional] in mozIVisitInfoCallback aCallback, [optional] in bool aGroupNotifications); */ /// Unable to generate binding because `native type JS::Value is unsupported` pub UpdatePlaces: *const ::libc::c_void, /* void isURIVisited (in nsIURI aURI, in mozIVisitedStatusCallback aCallback); */ pub IsURIVisited: unsafe extern "system" fn (this: *const mozIAsyncHistory, aURI: *const nsIURI, aCallback: *const mozIVisitedStatusCallback) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl mozIAsyncHistory { /// ```text /// /** /// * Adds a set of visits for one or more mozIPlaceInfo objects, and updates /// * each mozIPlaceInfo's title or guid. /// * /// * aCallback.handleResult is called for each visit added. /// * /// * @param aPlaceInfo /// * The mozIPlaceInfo object[s] containing the information to store or /// * update. This can be a single object, or an array of objects. /// * @param [optional] aCallback /// * A mozIVisitInfoCallback object which consists of callbacks to be /// * notified for successful and/or failed changes. /// * @param [optional] aGroupNotifications /// * If set to true, the implementation will attempt to avoid using /// * per-place/visit notifications as much as possible. /// * /// * @throws NS_ERROR_INVALID_ARG /// * - Passing in NULL for aPlaceInfo. /// * - Not providing at least one valid guid, or uri for all /// * mozIPlaceInfo object[s]. /// * - Not providing an array or nothing for the visits property of /// * mozIPlaceInfo. /// * - Not providing a visitDate and transitionType for each /// * mozIVisitInfo. /// * - Providing an invalid transitionType for a mozIVisitInfo. /// */ /// ``` /// /// `[implicit_jscontext] void updatePlaces (in jsval aPlaceInfo, [optional] in mozIVisitInfoCallback aCallback, [optional] in bool aGroupNotifications);` const _UpdatePlaces: () = (); /// ```text /// /** /// * Checks if a given URI has been visited. /// * /// * @param aURI /// * The URI to check for. /// * @param aCallback /// * A mozIVisitStatusCallback object which receives the visited status. /// */ /// ``` /// /// `void isURIVisited (in nsIURI aURI, in mozIVisitedStatusCallback aCallback);` #[inline] pub unsafe fn IsURIVisited(&self, aURI: *const nsIURI, aCallback: *const mozIVisitedStatusCallback) -> nsresult { ((*self.vtable).IsURIVisited)(self, aURI, aCallback) } }