Copy as Markdown

Other Tools

//
// DO NOT EDIT. THIS FILE IS GENERATED FROM $SRCDIR/netwerk/protocol/webtransport/nsIWebTransport.idl
//
/// `interface nsIWebTransport : 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 nsIWebTransport {
vtable: &'static nsIWebTransportVTable,
/// 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
// 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 nsIWebTransport.
unsafe impl XpCom for nsIWebTransport {
const IID: nsIID = nsID(0xc20d6e77, 0x8cb1, 0x4838,
[0xa8, 0x8d, 0xff, 0xf8, 0x26, 0x08, 0x0a, 0xa3]);
}
// 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 nsIWebTransport {
#[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 nsIWebTransport.
// 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 nsIWebTransportCoerce {
/// Cheaply cast a value of this type from a `nsIWebTransport`.
fn coerce_from(v: &nsIWebTransport) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIWebTransportCoerce for nsIWebTransport {
#[inline]
fn coerce_from(v: &nsIWebTransport) -> &Self {
v
}
}
impl nsIWebTransport {
/// Cast this `nsIWebTransport` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIWebTransportCoerce>(&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 nsIWebTransport {
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> nsIWebTransportCoerce for T {
#[inline]
fn coerce_from(v: &nsIWebTransport) -> &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 nsIWebTransport
// 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 nsIWebTransportVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void asyncConnect (in nsIURI aURI, in boolean aDedicated, in Array<nsIWebTransportHash> aServerCertHashes, in nsIPrincipal aLoadingPrincipal, in unsigned long aSecurityFlags, in WebTransportSessionEventListener aListener); */
pub AsyncConnect: unsafe extern "system" fn (this: *const nsIWebTransport, aURI: *const nsIURI, aDedicated: bool, aServerCertHashes: *const thin_vec::ThinVec<Option<RefPtr<nsIWebTransportHash>>>, aLoadingPrincipal: *const nsIPrincipal, aSecurityFlags: u32, aListener: *const WebTransportSessionEventListener) -> ::nserror::nsresult,
/* [noscript] void asyncConnectWithClient (in nsIURI aURI, in boolean aDedicated, in Array<nsIWebTransportHash> aServerCertHashes, in nsIPrincipal aLoadingPrincipal, in unsigned long aSecurityFlags, in WebTransportSessionEventListener aListener, in const_MaybeClientInfoRef aClientInfo); */
/// Unable to generate binding because `native type const mozilla::Maybe<mozilla::dom::ClientInfo> unsupported`
pub AsyncConnectWithClient: *const ::libc::c_void,
/* void getStats (); */
pub GetStats: unsafe extern "system" fn (this: *const nsIWebTransport) -> ::nserror::nsresult,
/* void closeSession (in uint32_t aErrorCode, in ACString aReason); */
pub CloseSession: unsafe extern "system" fn (this: *const nsIWebTransport, aErrorCode: u32, aReason: *const ::nsstring::nsACString) -> ::nserror::nsresult,
/* void createOutgoingBidirectionalStream (in nsIWebTransportStreamCallback aListener); */
pub CreateOutgoingBidirectionalStream: unsafe extern "system" fn (this: *const nsIWebTransport, aListener: *const nsIWebTransportStreamCallback) -> ::nserror::nsresult,
/* void createOutgoingUnidirectionalStream (in nsIWebTransportStreamCallback aListener); */
pub CreateOutgoingUnidirectionalStream: unsafe extern "system" fn (this: *const nsIWebTransport, aListener: *const nsIWebTransportStreamCallback) -> ::nserror::nsresult,
/* void sendDatagram (in Array<uint8_t> aData, in uint64_t aTrackingId); */
pub SendDatagram: unsafe extern "system" fn (this: *const nsIWebTransport, aData: *const thin_vec::ThinVec<u8>, aTrackingId: u64) -> ::nserror::nsresult,
/* void getMaxDatagramSize (); */
pub GetMaxDatagramSize: unsafe extern "system" fn (this: *const nsIWebTransport) -> ::nserror::nsresult,
/* [noscript] void retargetTo (in nsIEventTarget aTarget); */
pub RetargetTo: unsafe extern "system" fn (this: *const nsIWebTransport, aTarget: *const nsIEventTarget) -> ::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 nsIWebTransport {
pub const UNKNOWN_ERROR: u16 = 0;
pub const INVALID_STATE_ERROR: u16 = 1;
/// `void asyncConnect (in nsIURI aURI, in boolean aDedicated, in Array<nsIWebTransportHash> aServerCertHashes, in nsIPrincipal aLoadingPrincipal, in unsigned long aSecurityFlags, in WebTransportSessionEventListener aListener);`
#[inline]
pub unsafe fn AsyncConnect(&self, aURI: *const nsIURI, aDedicated: bool, aServerCertHashes: *const thin_vec::ThinVec<Option<RefPtr<nsIWebTransportHash>>>, aLoadingPrincipal: *const nsIPrincipal, aSecurityFlags: u32, aListener: *const WebTransportSessionEventListener) -> ::nserror::nsresult {
((*self.vtable).AsyncConnect)(self, aURI, aDedicated, aServerCertHashes, aLoadingPrincipal, aSecurityFlags, aListener)
}
/// `[noscript] void asyncConnectWithClient (in nsIURI aURI, in boolean aDedicated, in Array<nsIWebTransportHash> aServerCertHashes, in nsIPrincipal aLoadingPrincipal, in unsigned long aSecurityFlags, in WebTransportSessionEventListener aListener, in const_MaybeClientInfoRef aClientInfo);`
const _AsyncConnectWithClient: () = ();
/// `void getStats ();`
#[inline]
pub unsafe fn GetStats(&self, ) -> ::nserror::nsresult {
((*self.vtable).GetStats)(self, )
}
/// `void closeSession (in uint32_t aErrorCode, in ACString aReason);`
#[inline]
pub unsafe fn CloseSession(&self, aErrorCode: u32, aReason: *const ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).CloseSession)(self, aErrorCode, aReason)
}
/// `void createOutgoingBidirectionalStream (in nsIWebTransportStreamCallback aListener);`
#[inline]
pub unsafe fn CreateOutgoingBidirectionalStream(&self, aListener: *const nsIWebTransportStreamCallback) -> ::nserror::nsresult {
((*self.vtable).CreateOutgoingBidirectionalStream)(self, aListener)
}
/// `void createOutgoingUnidirectionalStream (in nsIWebTransportStreamCallback aListener);`
#[inline]
pub unsafe fn CreateOutgoingUnidirectionalStream(&self, aListener: *const nsIWebTransportStreamCallback) -> ::nserror::nsresult {
((*self.vtable).CreateOutgoingUnidirectionalStream)(self, aListener)
}
/// `void sendDatagram (in Array<uint8_t> aData, in uint64_t aTrackingId);`
#[inline]
pub unsafe fn SendDatagram(&self, aData: *const thin_vec::ThinVec<u8>, aTrackingId: u64) -> ::nserror::nsresult {
((*self.vtable).SendDatagram)(self, aData, aTrackingId)
}
/// `void getMaxDatagramSize ();`
#[inline]
pub unsafe fn GetMaxDatagramSize(&self, ) -> ::nserror::nsresult {
((*self.vtable).GetMaxDatagramSize)(self, )
}
/// `[noscript] void retargetTo (in nsIEventTarget aTarget);`
#[inline]
pub unsafe fn RetargetTo(&self, aTarget: *const nsIEventTarget) -> ::nserror::nsresult {
((*self.vtable).RetargetTo)(self, aTarget)
}
}
/// `interface WebTransportSessionEventListener : 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 WebTransportSessionEventListener {
vtable: &'static WebTransportSessionEventListenerVTable,
/// 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
// 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 WebTransportSessionEventListener.
unsafe impl XpCom for WebTransportSessionEventListener {
const IID: nsIID = nsID(0x0e3cb269, 0xf318, 0x43c8,
[0x95, 0x9e, 0x89, 0x7f, 0x57, 0x89, 0x4b, 0x71]);
}
// 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 WebTransportSessionEventListener {
#[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 WebTransportSessionEventListener.
// 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 WebTransportSessionEventListenerCoerce {
/// Cheaply cast a value of this type from a `WebTransportSessionEventListener`.
fn coerce_from(v: &WebTransportSessionEventListener) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl WebTransportSessionEventListenerCoerce for WebTransportSessionEventListener {
#[inline]
fn coerce_from(v: &WebTransportSessionEventListener) -> &Self {
v
}
}
impl WebTransportSessionEventListener {
/// Cast this `WebTransportSessionEventListener` to one of its base interfaces.
#[inline]
pub fn coerce<T: WebTransportSessionEventListenerCoerce>(&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 WebTransportSessionEventListener {
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> WebTransportSessionEventListenerCoerce for T {
#[inline]
fn coerce_from(v: &WebTransportSessionEventListener) -> &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 WebTransportSessionEventListener
// 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 WebTransportSessionEventListenerVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void onSessionReady (in uint64_t aSessionId); */
pub OnSessionReady: unsafe extern "system" fn (this: *const WebTransportSessionEventListener, aSessionId: u64) -> ::nserror::nsresult,
/* void onSessionClosed (in boolean aCleanly, in uint32_t aErrorCode, in ACString aReason); */
pub OnSessionClosed: unsafe extern "system" fn (this: *const WebTransportSessionEventListener, aCleanly: bool, aErrorCode: u32, aReason: *const ::nsstring::nsACString) -> ::nserror::nsresult,
/* void onIncomingBidirectionalStreamAvailable (in nsIWebTransportBidirectionalStream aStream); */
pub OnIncomingBidirectionalStreamAvailable: unsafe extern "system" fn (this: *const WebTransportSessionEventListener, aStream: *const nsIWebTransportBidirectionalStream) -> ::nserror::nsresult,
/* void onIncomingUnidirectionalStreamAvailable (in nsIWebTransportReceiveStream aStream); */
pub OnIncomingUnidirectionalStreamAvailable: unsafe extern "system" fn (this: *const WebTransportSessionEventListener, aStream: *const nsIWebTransportReceiveStream) -> ::nserror::nsresult,
/* void onStopSending (in uint64_t aStreamId, in nsresult aError); */
pub OnStopSending: unsafe extern "system" fn (this: *const WebTransportSessionEventListener, aStreamId: u64, aError: nserror::nsresult) -> ::nserror::nsresult,
/* void onResetReceived (in uint64_t aStreamId, in nsresult aError); */
pub OnResetReceived: unsafe extern "system" fn (this: *const WebTransportSessionEventListener, aStreamId: u64, aError: nserror::nsresult) -> ::nserror::nsresult,
/* void onDatagramReceived (in Array<uint8_t> aData); */
pub OnDatagramReceived: unsafe extern "system" fn (this: *const WebTransportSessionEventListener, aData: *const thin_vec::ThinVec<u8>) -> ::nserror::nsresult,
/* void onMaxDatagramSize (in uint64_t aSize); */
pub OnMaxDatagramSize: unsafe extern "system" fn (this: *const WebTransportSessionEventListener, aSize: u64) -> ::nserror::nsresult,
/* void onOutgoingDatagramOutCome (in uint64_t aId, in WebTransportSessionEventListener_DatagramOutcome aOutCome); */
pub OnOutgoingDatagramOutCome: unsafe extern "system" fn (this: *const WebTransportSessionEventListener, aId: u64, aOutCome: u32) -> ::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 WebTransportSessionEventListener {
pub const UNKNOWN: u32 = 0;
pub const DROPPED_TOO_MUCH_DATA: u32 = 1;
pub const SENT: u32 = 2;
/// `void onSessionReady (in uint64_t aSessionId);`
#[inline]
pub unsafe fn OnSessionReady(&self, aSessionId: u64) -> ::nserror::nsresult {
((*self.vtable).OnSessionReady)(self, aSessionId)
}
/// `void onSessionClosed (in boolean aCleanly, in uint32_t aErrorCode, in ACString aReason);`
#[inline]
pub unsafe fn OnSessionClosed(&self, aCleanly: bool, aErrorCode: u32, aReason: *const ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).OnSessionClosed)(self, aCleanly, aErrorCode, aReason)
}
/// `void onIncomingBidirectionalStreamAvailable (in nsIWebTransportBidirectionalStream aStream);`
#[inline]
pub unsafe fn OnIncomingBidirectionalStreamAvailable(&self, aStream: *const nsIWebTransportBidirectionalStream) -> ::nserror::nsresult {
((*self.vtable).OnIncomingBidirectionalStreamAvailable)(self, aStream)
}
/// `void onIncomingUnidirectionalStreamAvailable (in nsIWebTransportReceiveStream aStream);`
#[inline]
pub unsafe fn OnIncomingUnidirectionalStreamAvailable(&self, aStream: *const nsIWebTransportReceiveStream) -> ::nserror::nsresult {
((*self.vtable).OnIncomingUnidirectionalStreamAvailable)(self, aStream)
}
/// `void onStopSending (in uint64_t aStreamId, in nsresult aError);`
#[inline]
pub unsafe fn OnStopSending(&self, aStreamId: u64, aError: nserror::nsresult) -> ::nserror::nsresult {
((*self.vtable).OnStopSending)(self, aStreamId, aError)
}
/// `void onResetReceived (in uint64_t aStreamId, in nsresult aError);`
#[inline]
pub unsafe fn OnResetReceived(&self, aStreamId: u64, aError: nserror::nsresult) -> ::nserror::nsresult {
((*self.vtable).OnResetReceived)(self, aStreamId, aError)
}
/// `void onDatagramReceived (in Array<uint8_t> aData);`
#[inline]
pub unsafe fn OnDatagramReceived(&self, aData: *const thin_vec::ThinVec<u8>) -> ::nserror::nsresult {
((*self.vtable).OnDatagramReceived)(self, aData)
}
/// `void onMaxDatagramSize (in uint64_t aSize);`
#[inline]
pub unsafe fn OnMaxDatagramSize(&self, aSize: u64) -> ::nserror::nsresult {
((*self.vtable).OnMaxDatagramSize)(self, aSize)
}
/// `void onOutgoingDatagramOutCome (in uint64_t aId, in WebTransportSessionEventListener_DatagramOutcome aOutCome);`
#[inline]
pub unsafe fn OnOutgoingDatagramOutCome(&self, aId: u64, aOutCome: u32) -> ::nserror::nsresult {
((*self.vtable).OnOutgoingDatagramOutCome)(self, aId, aOutCome)
}
}
/// `interface WebTransportSessionEventListenerInternal : 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 WebTransportSessionEventListenerInternal {
vtable: &'static WebTransportSessionEventListenerInternalVTable,
/// 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
// 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 WebTransportSessionEventListenerInternal.
unsafe impl XpCom for WebTransportSessionEventListenerInternal {
const IID: nsIID = nsID(0x8fb30aa9, 0x5163, 0x4eb3,
[0x81, 0xf3, 0x37, 0x1e, 0x1c, 0xcb, 0x5b, 0x0e]);
}
// 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 WebTransportSessionEventListenerInternal {
#[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 WebTransportSessionEventListenerInternal.
// 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 WebTransportSessionEventListenerInternalCoerce {
/// Cheaply cast a value of this type from a `WebTransportSessionEventListenerInternal`.
fn coerce_from(v: &WebTransportSessionEventListenerInternal) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl WebTransportSessionEventListenerInternalCoerce for WebTransportSessionEventListenerInternal {
#[inline]
fn coerce_from(v: &WebTransportSessionEventListenerInternal) -> &Self {
v
}
}
impl WebTransportSessionEventListenerInternal {
/// Cast this `WebTransportSessionEventListenerInternal` to one of its base interfaces.
#[inline]
pub fn coerce<T: WebTransportSessionEventListenerInternalCoerce>(&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 WebTransportSessionEventListenerInternal {
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> WebTransportSessionEventListenerInternalCoerce for T {
#[inline]
fn coerce_from(v: &WebTransportSessionEventListenerInternal) -> &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 WebTransportSessionEventListenerInternal
// 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 WebTransportSessionEventListenerInternalVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void onSessionReadyInternal (in Http3WebTransportSessionPtr aSession); */
/// Unable to generate binding because `native type mozilla::net::Http3WebTransportSession unsupported`
pub OnSessionReadyInternal: *const ::libc::c_void,
/* void onIncomingStreamAvailableInternal (in Http3WebTransportStreamPtr aStream); */
/// Unable to generate binding because `native type mozilla::net::Http3WebTransportStream unsupported`
pub OnIncomingStreamAvailableInternal: *const ::libc::c_void,
/* void onDatagramReceivedInternal (in Datagram aData); */
/// Unable to generate binding because `Rust only supports [ref] / [ptr] native types`
pub OnDatagramReceivedInternal: *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 WebTransportSessionEventListenerInternal {
/// `void onSessionReadyInternal (in Http3WebTransportSessionPtr aSession);`
const _OnSessionReadyInternal: () = ();
/// `void onIncomingStreamAvailableInternal (in Http3WebTransportStreamPtr aStream);`
const _OnIncomingStreamAvailableInternal: () = ();
/// `void onDatagramReceivedInternal (in Datagram aData);`
const _OnDatagramReceivedInternal: () = ();
}
/// `interface WebTransportConnectionSettings : 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 WebTransportConnectionSettings {
vtable: &'static WebTransportConnectionSettingsVTable,
/// 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
// 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 WebTransportConnectionSettings.
unsafe impl XpCom for WebTransportConnectionSettings {
const IID: nsIID = nsID(0xfaad75bd, 0x83c6, 0x420b,
[0x9f, 0xdb, 0xa7, 0x0b, 0xd7, 0x0b, 0xe4, 0x49]);
}
// 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 WebTransportConnectionSettings {
#[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 WebTransportConnectionSettings.
// 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 WebTransportConnectionSettingsCoerce {
/// Cheaply cast a value of this type from a `WebTransportConnectionSettings`.
fn coerce_from(v: &WebTransportConnectionSettings) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl WebTransportConnectionSettingsCoerce for WebTransportConnectionSettings {
#[inline]
fn coerce_from(v: &WebTransportConnectionSettings) -> &Self {
v
}
}
impl WebTransportConnectionSettings {
/// Cast this `WebTransportConnectionSettings` to one of its base interfaces.
#[inline]
pub fn coerce<T: WebTransportConnectionSettingsCoerce>(&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 WebTransportConnectionSettings {
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> WebTransportConnectionSettingsCoerce for T {
#[inline]
fn coerce_from(v: &WebTransportConnectionSettings) -> &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 WebTransportConnectionSettings
// 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 WebTransportConnectionSettingsVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* readonly attribute boolean dedicated; */
pub GetDedicated: unsafe extern "system" fn (this: *const WebTransportConnectionSettings, aDedicated: *mut bool) -> ::nserror::nsresult,
/* void getServerCertificateHashes (out Array<nsIWebTransportHash> aServerCertHashes); */
pub GetServerCertificateHashes: unsafe extern "system" fn (this: *const WebTransportConnectionSettings, aServerCertHashes: *mut thin_vec::ThinVec<Option<RefPtr<nsIWebTransportHash>>>) -> ::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 WebTransportConnectionSettings {
/// `readonly attribute boolean dedicated;`
#[inline]
pub unsafe fn GetDedicated(&self, aDedicated: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetDedicated)(self, aDedicated)
}
/// `void getServerCertificateHashes (out Array<nsIWebTransportHash> aServerCertHashes);`
#[inline]
pub unsafe fn GetServerCertificateHashes(&self, aServerCertHashes: *mut thin_vec::ThinVec<Option<RefPtr<nsIWebTransportHash>>>) -> ::nserror::nsresult {
((*self.vtable).GetServerCertificateHashes)(self, aServerCertHashes)
}
}
/// `interface nsIWebTransportStreamCallback : 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 nsIWebTransportStreamCallback {
vtable: &'static nsIWebTransportStreamCallbackVTable,
/// 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
// 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 nsIWebTransportStreamCallback.
unsafe impl XpCom for nsIWebTransportStreamCallback {
const IID: nsIID = nsID(0xc6eeff1d, 0x599b, 0x40a8,
[0x91, 0x57, 0xc7, 0xa4, 0x0c, 0x3d, 0x51, 0xa2]);
}
// 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 nsIWebTransportStreamCallback {
#[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 nsIWebTransportStreamCallback.
// 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 nsIWebTransportStreamCallbackCoerce {
/// Cheaply cast a value of this type from a `nsIWebTransportStreamCallback`.
fn coerce_from(v: &nsIWebTransportStreamCallback) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIWebTransportStreamCallbackCoerce for nsIWebTransportStreamCallback {
#[inline]
fn coerce_from(v: &nsIWebTransportStreamCallback) -> &Self {
v
}
}
impl nsIWebTransportStreamCallback {
/// Cast this `nsIWebTransportStreamCallback` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIWebTransportStreamCallbackCoerce>(&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 nsIWebTransportStreamCallback {
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> nsIWebTransportStreamCallbackCoerce for T {
#[inline]
fn coerce_from(v: &nsIWebTransportStreamCallback) -> &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 nsIWebTransportStreamCallback
// 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 nsIWebTransportStreamCallbackVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void onBidirectionalStreamReady (in nsIWebTransportBidirectionalStream aStream); */
pub OnBidirectionalStreamReady: unsafe extern "system" fn (this: *const nsIWebTransportStreamCallback, aStream: *const nsIWebTransportBidirectionalStream) -> ::nserror::nsresult,
/* void onUnidirectionalStreamReady (in nsIWebTransportSendStream aStream); */
pub OnUnidirectionalStreamReady: unsafe extern "system" fn (this: *const nsIWebTransportStreamCallback, aStream: *const nsIWebTransportSendStream) -> ::nserror::nsresult,
/* void onError (in uint8_t aError); */
pub OnError: unsafe extern "system" fn (this: *const nsIWebTransportStreamCallback, aError: u8) -> ::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 nsIWebTransportStreamCallback {
/// `void onBidirectionalStreamReady (in nsIWebTransportBidirectionalStream aStream);`
#[inline]
pub unsafe fn OnBidirectionalStreamReady(&self, aStream: *const nsIWebTransportBidirectionalStream) -> ::nserror::nsresult {
((*self.vtable).OnBidirectionalStreamReady)(self, aStream)
}
/// `void onUnidirectionalStreamReady (in nsIWebTransportSendStream aStream);`
#[inline]
pub unsafe fn OnUnidirectionalStreamReady(&self, aStream: *const nsIWebTransportSendStream) -> ::nserror::nsresult {
((*self.vtable).OnUnidirectionalStreamReady)(self, aStream)
}
/// `void onError (in uint8_t aError);`
#[inline]
pub unsafe fn OnError(&self, aError: u8) -> ::nserror::nsresult {
((*self.vtable).OnError)(self, aError)
}
}
/// `interface nsIWebTransportHash : 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 nsIWebTransportHash {
vtable: &'static nsIWebTransportHashVTable,
/// 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
// 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 nsIWebTransportHash.
unsafe impl XpCom for nsIWebTransportHash {
const IID: nsIID = nsID(0x2523a26e, 0x94be, 0x4de6,
[0x8c, 0x27, 0x9b, 0x4f, 0xff, 0xf7, 0x42, 0xf0]);
}
// 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 nsIWebTransportHash {
#[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 nsIWebTransportHash.
// 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 nsIWebTransportHashCoerce {
/// Cheaply cast a value of this type from a `nsIWebTransportHash`.
fn coerce_from(v: &nsIWebTransportHash) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIWebTransportHashCoerce for nsIWebTransportHash {
#[inline]
fn coerce_from(v: &nsIWebTransportHash) -> &Self {
v
}
}
impl nsIWebTransportHash {
/// Cast this `nsIWebTransportHash` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIWebTransportHashCoerce>(&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 nsIWebTransportHash {
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> nsIWebTransportHashCoerce for T {
#[inline]
fn coerce_from(v: &nsIWebTransportHash) -> &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 nsIWebTransportHash
// 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 nsIWebTransportHashVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* readonly attribute ACString algorithm; */
pub GetAlgorithm: unsafe extern "system" fn (this: *const nsIWebTransportHash, aAlgorithm: *mut ::nsstring::nsACString) -> ::nserror::nsresult,
/* readonly attribute Array<uint8_t> value; */
pub GetValue: unsafe extern "system" fn (this: *const nsIWebTransportHash, aValue: *mut thin_vec::ThinVec<u8>) -> ::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 nsIWebTransportHash {
/// `readonly attribute ACString algorithm;`
#[inline]
pub unsafe fn GetAlgorithm(&self, aAlgorithm: *mut ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).GetAlgorithm)(self, aAlgorithm)
}
/// `readonly attribute Array<uint8_t> value;`
#[inline]
pub unsafe fn GetValue(&self, aValue: *mut thin_vec::ThinVec<u8>) -> ::nserror::nsresult {
((*self.vtable).GetValue)(self, aValue)
}
}