Copy as Markdown
Other Tools
//
// DO NOT EDIT. THIS FILE IS GENERATED FROM $SRCDIR/widget/nsIGeckoViewBridge.idl
//
/// `interface nsIGeckoViewEventCallback : 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 nsIGeckoViewEventCallback {
vtable: &'static nsIGeckoViewEventCallbackVTable,
/// This field is a phantomdata to ensure that the VTable type and any
/// struct containing it is not safe to send across threads by default, as
/// XPCOM is generally not threadsafe.
///
/// If this type is marked as [rust_sync], there will be explicit `Send` and
/// `Sync` implementations on this type, which will override the inherited
/// negative impls from `Rc`.
__nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
// Make the rust compiler aware that there might be interior mutability
// in what actually implements the interface. This works around UB
// introduced by https://github.com/llvm/llvm-project/commit/01859da84bad95fd51d6a03b08b60c660e642a4f
// that a rust lint would make blatantly obvious, but doesn't exist.
// This prevents optimizations, but those optimizations weren't available
// before rustc switched to LLVM 16, and they now cause problems because
// of the UB.
// Until there's a lint available to find all our UB, it's simpler to
// avoid the UB in the first place, at the cost of preventing optimizations
// in places that don't cause UB. But again, those optimizations weren't
// available before.
__maybe_interior_mutability: ::std::cell::UnsafeCell<[u8; 0]>,
}
// 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 nsIGeckoViewEventCallback.
unsafe impl XpCom for nsIGeckoViewEventCallback {
const IID: nsIID = nsID(0xe64c39b8, 0xb8ec, 0x477d,
[0xae, 0xf5, 0x89, 0xd5, 0x17, 0xff, 0x92, 0x19]);
}
// 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 nsIGeckoViewEventCallback {
#[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 nsIGeckoViewEventCallback.
// 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 nsIGeckoViewEventCallbackCoerce {
/// Cheaply cast a value of this type from a `nsIGeckoViewEventCallback`.
fn coerce_from(v: &nsIGeckoViewEventCallback) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIGeckoViewEventCallbackCoerce for nsIGeckoViewEventCallback {
#[inline]
fn coerce_from(v: &nsIGeckoViewEventCallback) -> &Self {
v
}
}
impl nsIGeckoViewEventCallback {
/// Cast this `nsIGeckoViewEventCallback` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIGeckoViewEventCallbackCoerce>(&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 nsIGeckoViewEventCallback {
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> nsIGeckoViewEventCallbackCoerce for T {
#[inline]
fn coerce_from(v: &nsIGeckoViewEventCallback) -> &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 nsIGeckoViewEventCallback
// 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 nsIGeckoViewEventCallbackVTable {
/// 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 onSuccess ([optional] in jsval data); */
/// Unable to generate binding because `special type jsval unsupported`
pub OnSuccess: *const ::libc::c_void,
/* [implicit_jscontext] void onError ([optional] in jsval data); */
/// Unable to generate binding because `special type jsval unsupported`
pub OnError: *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 nsIGeckoViewEventCallback {
/// `[implicit_jscontext] void onSuccess ([optional] in jsval data);`
const _OnSuccess: () = ();
/// `[implicit_jscontext] void onError ([optional] in jsval data);`
const _OnError: () = ();
}
/// `interface nsIGeckoViewEventFinalizer : 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 nsIGeckoViewEventFinalizer {
vtable: &'static nsIGeckoViewEventFinalizerVTable,
/// This field is a phantomdata to ensure that the VTable type and any
/// struct containing it is not safe to send across threads by default, as
/// XPCOM is generally not threadsafe.
///
/// If this type is marked as [rust_sync], there will be explicit `Send` and
/// `Sync` implementations on this type, which will override the inherited
/// negative impls from `Rc`.
__nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
// Make the rust compiler aware that there might be interior mutability
// in what actually implements the interface. This works around UB
// introduced by https://github.com/llvm/llvm-project/commit/01859da84bad95fd51d6a03b08b60c660e642a4f
// that a rust lint would make blatantly obvious, but doesn't exist.
// This prevents optimizations, but those optimizations weren't available
// before rustc switched to LLVM 16, and they now cause problems because
// of the UB.
// Until there's a lint available to find all our UB, it's simpler to
// avoid the UB in the first place, at the cost of preventing optimizations
// in places that don't cause UB. But again, those optimizations weren't
// available before.
__maybe_interior_mutability: ::std::cell::UnsafeCell<[u8; 0]>,
}
// 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 nsIGeckoViewEventFinalizer.
unsafe impl XpCom for nsIGeckoViewEventFinalizer {
const IID: nsIID = nsID(0x819ee2db, 0xd3b8, 0x46dd,
[0xa4, 0x76, 0x40, 0xf8, 0x9c, 0x49, 0x13, 0x3c]);
}
// 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 nsIGeckoViewEventFinalizer {
#[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 nsIGeckoViewEventFinalizer.
// 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 nsIGeckoViewEventFinalizerCoerce {
/// Cheaply cast a value of this type from a `nsIGeckoViewEventFinalizer`.
fn coerce_from(v: &nsIGeckoViewEventFinalizer) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIGeckoViewEventFinalizerCoerce for nsIGeckoViewEventFinalizer {
#[inline]
fn coerce_from(v: &nsIGeckoViewEventFinalizer) -> &Self {
v
}
}
impl nsIGeckoViewEventFinalizer {
/// Cast this `nsIGeckoViewEventFinalizer` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIGeckoViewEventFinalizerCoerce>(&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 nsIGeckoViewEventFinalizer {
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> nsIGeckoViewEventFinalizerCoerce for T {
#[inline]
fn coerce_from(v: &nsIGeckoViewEventFinalizer) -> &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 nsIGeckoViewEventFinalizer
// 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 nsIGeckoViewEventFinalizerVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void onFinalize (); */
pub OnFinalize: unsafe extern "system" fn (this: *const nsIGeckoViewEventFinalizer) -> ::nserror::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 nsIGeckoViewEventFinalizer {
/// `void onFinalize ();`
#[inline]
pub unsafe fn OnFinalize(&self, ) -> ::nserror::nsresult {
((*self.vtable).OnFinalize)(self, )
}
}
/// `interface nsIGeckoViewEventListener : 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 nsIGeckoViewEventListener {
vtable: &'static nsIGeckoViewEventListenerVTable,
/// This field is a phantomdata to ensure that the VTable type and any
/// struct containing it is not safe to send across threads by default, as
/// XPCOM is generally not threadsafe.
///
/// If this type is marked as [rust_sync], there will be explicit `Send` and
/// `Sync` implementations on this type, which will override the inherited
/// negative impls from `Rc`.
__nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
// Make the rust compiler aware that there might be interior mutability
// in what actually implements the interface. This works around UB
// introduced by https://github.com/llvm/llvm-project/commit/01859da84bad95fd51d6a03b08b60c660e642a4f
// that a rust lint would make blatantly obvious, but doesn't exist.
// This prevents optimizations, but those optimizations weren't available
// before rustc switched to LLVM 16, and they now cause problems because
// of the UB.
// Until there's a lint available to find all our UB, it's simpler to
// avoid the UB in the first place, at the cost of preventing optimizations
// in places that don't cause UB. But again, those optimizations weren't
// available before.
__maybe_interior_mutability: ::std::cell::UnsafeCell<[u8; 0]>,
}
// 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 nsIGeckoViewEventListener.
unsafe impl XpCom for nsIGeckoViewEventListener {
const IID: nsIID = nsID(0x73569a75, 0x78eb, 0x4c7f,
[0x82, 0xb9, 0x2d, 0x4f, 0x5c, 0xcf, 0x44, 0xc3]);
}
// 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 nsIGeckoViewEventListener {
#[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 nsIGeckoViewEventListener.
// 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 nsIGeckoViewEventListenerCoerce {
/// Cheaply cast a value of this type from a `nsIGeckoViewEventListener`.
fn coerce_from(v: &nsIGeckoViewEventListener) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIGeckoViewEventListenerCoerce for nsIGeckoViewEventListener {
#[inline]
fn coerce_from(v: &nsIGeckoViewEventListener) -> &Self {
v
}
}
impl nsIGeckoViewEventListener {
/// Cast this `nsIGeckoViewEventListener` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIGeckoViewEventListenerCoerce>(&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 nsIGeckoViewEventListener {
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> nsIGeckoViewEventListenerCoerce for T {
#[inline]
fn coerce_from(v: &nsIGeckoViewEventListener) -> &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 nsIGeckoViewEventListener
// 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 nsIGeckoViewEventListenerVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void onEvent (in AString event, [optional] in jsval data, [optional] in nsIGeckoViewEventCallback callback); */
/// Unable to generate binding because `special type jsval unsupported`
pub OnEvent: *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 nsIGeckoViewEventListener {
/// `void onEvent (in AString event, [optional] in jsval data, [optional] in nsIGeckoViewEventCallback callback);`
const _OnEvent: () = ();
}
/// `interface nsIGeckoViewEventDispatcher : 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 nsIGeckoViewEventDispatcher {
vtable: &'static nsIGeckoViewEventDispatcherVTable,
/// This field is a phantomdata to ensure that the VTable type and any
/// struct containing it is not safe to send across threads by default, as
/// XPCOM is generally not threadsafe.
///
/// If this type is marked as [rust_sync], there will be explicit `Send` and
/// `Sync` implementations on this type, which will override the inherited
/// negative impls from `Rc`.
__nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
// Make the rust compiler aware that there might be interior mutability
// in what actually implements the interface. This works around UB
// introduced by https://github.com/llvm/llvm-project/commit/01859da84bad95fd51d6a03b08b60c660e642a4f
// that a rust lint would make blatantly obvious, but doesn't exist.
// This prevents optimizations, but those optimizations weren't available
// before rustc switched to LLVM 16, and they now cause problems because
// of the UB.
// Until there's a lint available to find all our UB, it's simpler to
// avoid the UB in the first place, at the cost of preventing optimizations
// in places that don't cause UB. But again, those optimizations weren't
// available before.
__maybe_interior_mutability: ::std::cell::UnsafeCell<[u8; 0]>,
}
// 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 nsIGeckoViewEventDispatcher.
unsafe impl XpCom for nsIGeckoViewEventDispatcher {
const IID: nsIID = nsID(0xe98bf792, 0x4145, 0x411e,
[0xb2, 0x98, 0x82, 0x19, 0xd9, 0xb0, 0x38, 0x17]);
}
// 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 nsIGeckoViewEventDispatcher {
#[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 nsIGeckoViewEventDispatcher.
// 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 nsIGeckoViewEventDispatcherCoerce {
/// Cheaply cast a value of this type from a `nsIGeckoViewEventDispatcher`.
fn coerce_from(v: &nsIGeckoViewEventDispatcher) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIGeckoViewEventDispatcherCoerce for nsIGeckoViewEventDispatcher {
#[inline]
fn coerce_from(v: &nsIGeckoViewEventDispatcher) -> &Self {
v
}
}
impl nsIGeckoViewEventDispatcher {
/// Cast this `nsIGeckoViewEventDispatcher` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIGeckoViewEventDispatcherCoerce>(&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 nsIGeckoViewEventDispatcher {
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> nsIGeckoViewEventDispatcherCoerce for T {
#[inline]
fn coerce_from(v: &nsIGeckoViewEventDispatcher) -> &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 nsIGeckoViewEventDispatcher
// 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 nsIGeckoViewEventDispatcherVTable {
/// 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 dispatch (in jsval event, [optional] in jsval data, [optional] in nsIGeckoViewEventCallback callback, [optional] in nsIGeckoViewEventFinalizer finalizer); */
/// Unable to generate binding because `special type jsval unsupported`
pub Dispatch: *const ::libc::c_void,
/* [implicit_jscontext] void registerListener (in nsIGeckoViewEventListener listener, in jsval events); */
/// Unable to generate binding because `special type jsval unsupported`
pub RegisterListener: *const ::libc::c_void,
/* [implicit_jscontext] void unregisterListener (in nsIGeckoViewEventListener listener, in jsval events); */
/// Unable to generate binding because `special type jsval unsupported`
pub UnregisterListener: *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 nsIGeckoViewEventDispatcher {
/// `[implicit_jscontext] void dispatch (in jsval event, [optional] in jsval data, [optional] in nsIGeckoViewEventCallback callback, [optional] in nsIGeckoViewEventFinalizer finalizer);`
const _Dispatch: () = ();
/// `[implicit_jscontext] void registerListener (in nsIGeckoViewEventListener listener, in jsval events);`
const _RegisterListener: () = ();
/// `[implicit_jscontext] void unregisterListener (in nsIGeckoViewEventListener listener, in jsval events);`
const _UnregisterListener: () = ();
}
/// `interface nsIGeckoViewView : nsIGeckoViewEventDispatcher`
///
// 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 nsIGeckoViewView {
vtable: &'static nsIGeckoViewViewVTable,
/// This field is a phantomdata to ensure that the VTable type and any
/// struct containing it is not safe to send across threads by default, as
/// XPCOM is generally not threadsafe.
///
/// If this type is marked as [rust_sync], there will be explicit `Send` and
/// `Sync` implementations on this type, which will override the inherited
/// negative impls from `Rc`.
__nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
// Make the rust compiler aware that there might be interior mutability
// in what actually implements the interface. This works around UB
// introduced by https://github.com/llvm/llvm-project/commit/01859da84bad95fd51d6a03b08b60c660e642a4f
// that a rust lint would make blatantly obvious, but doesn't exist.
// This prevents optimizations, but those optimizations weren't available
// before rustc switched to LLVM 16, and they now cause problems because
// of the UB.
// Until there's a lint available to find all our UB, it's simpler to
// avoid the UB in the first place, at the cost of preventing optimizations
// in places that don't cause UB. But again, those optimizations weren't
// available before.
__maybe_interior_mutability: ::std::cell::UnsafeCell<[u8; 0]>,
}
// 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 nsIGeckoViewView.
unsafe impl XpCom for nsIGeckoViewView {
const IID: nsIID = nsID(0x60a78a94, 0x6117, 0x432f,
[0x9d, 0x49, 0x30, 0x49, 0x13, 0xa9, 0x31, 0xc5]);
}
// 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 nsIGeckoViewView {
#[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 nsIGeckoViewView.
// 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 nsIGeckoViewViewCoerce {
/// Cheaply cast a value of this type from a `nsIGeckoViewView`.
fn coerce_from(v: &nsIGeckoViewView) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIGeckoViewViewCoerce for nsIGeckoViewView {
#[inline]
fn coerce_from(v: &nsIGeckoViewView) -> &Self {
v
}
}
impl nsIGeckoViewView {
/// Cast this `nsIGeckoViewView` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIGeckoViewViewCoerce>(&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 nsIGeckoViewView {
type Target = nsIGeckoViewEventDispatcher;
#[inline]
fn deref(&self) -> &nsIGeckoViewEventDispatcher {
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: nsIGeckoViewEventDispatcherCoerce> nsIGeckoViewViewCoerce for T {
#[inline]
fn coerce_from(v: &nsIGeckoViewView) -> &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 nsIGeckoViewView
// 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 nsIGeckoViewViewVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsIGeckoViewEventDispatcherVTable,
/* [implicit_jscontext] readonly attribute jsval initData; */
/// Unable to generate binding because `special type jsval unsupported`
pub GetInitData: *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 nsIGeckoViewView {
/// `[implicit_jscontext] readonly attribute jsval initData;`
const _GetInitData: () = ();
}
/// `interface nsIGeckoViewBridge : nsIGeckoViewEventDispatcher`
///
// 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 nsIGeckoViewBridge {
vtable: &'static nsIGeckoViewBridgeVTable,
/// This field is a phantomdata to ensure that the VTable type and any
/// struct containing it is not safe to send across threads by default, as
/// XPCOM is generally not threadsafe.
///
/// If this type is marked as [rust_sync], there will be explicit `Send` and
/// `Sync` implementations on this type, which will override the inherited
/// negative impls from `Rc`.
__nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
// Make the rust compiler aware that there might be interior mutability
// in what actually implements the interface. This works around UB
// introduced by https://github.com/llvm/llvm-project/commit/01859da84bad95fd51d6a03b08b60c660e642a4f
// that a rust lint would make blatantly obvious, but doesn't exist.
// This prevents optimizations, but those optimizations weren't available
// before rustc switched to LLVM 16, and they now cause problems because
// of the UB.
// Until there's a lint available to find all our UB, it's simpler to
// avoid the UB in the first place, at the cost of preventing optimizations
// in places that don't cause UB. But again, those optimizations weren't
// available before.
__maybe_interior_mutability: ::std::cell::UnsafeCell<[u8; 0]>,
}
// 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 nsIGeckoViewBridge.
unsafe impl XpCom for nsIGeckoViewBridge {
const IID: nsIID = nsID(0x1beb70d3, 0x70f3, 0x4742,
[0x98, 0xcc, 0xa3, 0xd3, 0x01, 0xb2, 0x6c, 0x0c]);
}
// 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 nsIGeckoViewBridge {
#[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 nsIGeckoViewBridge.
// 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 nsIGeckoViewBridgeCoerce {
/// Cheaply cast a value of this type from a `nsIGeckoViewBridge`.
fn coerce_from(v: &nsIGeckoViewBridge) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIGeckoViewBridgeCoerce for nsIGeckoViewBridge {
#[inline]
fn coerce_from(v: &nsIGeckoViewBridge) -> &Self {
v
}
}
impl nsIGeckoViewBridge {
/// Cast this `nsIGeckoViewBridge` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIGeckoViewBridgeCoerce>(&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 nsIGeckoViewBridge {
type Target = nsIGeckoViewEventDispatcher;
#[inline]
fn deref(&self) -> &nsIGeckoViewEventDispatcher {
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: nsIGeckoViewEventDispatcherCoerce> nsIGeckoViewBridgeCoerce for T {
#[inline]
fn coerce_from(v: &nsIGeckoViewBridge) -> &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 nsIGeckoViewBridge
// 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 nsIGeckoViewBridgeVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsIGeckoViewEventDispatcherVTable,
/* nsIGeckoViewEventDispatcher getDispatcherByName (in string name); */
pub GetDispatcherByName: unsafe extern "system" fn (this: *const nsIGeckoViewBridge, name: *const libc::c_char, _retval: *mut *const nsIGeckoViewEventDispatcher) -> ::nserror::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 nsIGeckoViewBridge {
/// `nsIGeckoViewEventDispatcher getDispatcherByName (in string name);`
#[inline]
pub unsafe fn GetDispatcherByName(&self, name: *const libc::c_char, _retval: *mut *const nsIGeckoViewEventDispatcher) -> ::nserror::nsresult {
((*self.vtable).GetDispatcherByName)(self, name, _retval)
}
}