Copy as Markdown

Other Tools

//
// DO NOT EDIT. THIS FILE IS GENERATED FROM $SRCDIR/netwerk/protocol/webtransport/nsIWebTransportStream.idl
//
/// `interface nsIWebTransportSendStreamStats : 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 nsIWebTransportSendStreamStats {
vtable: &'static nsIWebTransportSendStreamStatsVTable,
/// 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 nsIWebTransportSendStreamStats.
unsafe impl XpCom for nsIWebTransportSendStreamStats {
const IID: nsIID = nsID(0xccc3e685, 0x8411, 0x48f0,
[0x8b, 0x3e, 0xff, 0x6d, 0x1f, 0xae, 0x48, 0x09]);
}
// 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 nsIWebTransportSendStreamStats {
#[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 nsIWebTransportSendStreamStats.
// 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 nsIWebTransportSendStreamStatsCoerce {
/// Cheaply cast a value of this type from a `nsIWebTransportSendStreamStats`.
fn coerce_from(v: &nsIWebTransportSendStreamStats) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIWebTransportSendStreamStatsCoerce for nsIWebTransportSendStreamStats {
#[inline]
fn coerce_from(v: &nsIWebTransportSendStreamStats) -> &Self {
v
}
}
impl nsIWebTransportSendStreamStats {
/// Cast this `nsIWebTransportSendStreamStats` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIWebTransportSendStreamStatsCoerce>(&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 nsIWebTransportSendStreamStats {
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> nsIWebTransportSendStreamStatsCoerce for T {
#[inline]
fn coerce_from(v: &nsIWebTransportSendStreamStats) -> &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 nsIWebTransportSendStreamStats
// 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 nsIWebTransportSendStreamStatsVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* [noscript] readonly attribute TimeStamp timestamp; */
/// Unable to generate binding because `Rust only supports [ref] / [ptr] native types`
pub GetTimestamp: *const ::libc::c_void,
/* readonly attribute unsigned long long bytesSent; */
pub GetBytesSent: unsafe extern "system" fn (this: *const nsIWebTransportSendStreamStats, aBytesSent: *mut u64) -> ::nserror::nsresult,
/* readonly attribute unsigned long long bytesAcknowledged; */
pub GetBytesAcknowledged: unsafe extern "system" fn (this: *const nsIWebTransportSendStreamStats, aBytesAcknowledged: *mut u64) -> ::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 nsIWebTransportSendStreamStats {
/// `[noscript] readonly attribute TimeStamp timestamp;`
const _GetTimestamp: () = ();
/// `readonly attribute unsigned long long bytesSent;`
#[inline]
pub unsafe fn GetBytesSent(&self, aBytesSent: *mut u64) -> ::nserror::nsresult {
((*self.vtable).GetBytesSent)(self, aBytesSent)
}
/// `readonly attribute unsigned long long bytesAcknowledged;`
#[inline]
pub unsafe fn GetBytesAcknowledged(&self, aBytesAcknowledged: *mut u64) -> ::nserror::nsresult {
((*self.vtable).GetBytesAcknowledged)(self, aBytesAcknowledged)
}
}
/// `interface nsIWebTransportReceiveStreamStats : 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 nsIWebTransportReceiveStreamStats {
vtable: &'static nsIWebTransportReceiveStreamStatsVTable,
/// 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 nsIWebTransportReceiveStreamStats.
unsafe impl XpCom for nsIWebTransportReceiveStreamStats {
const IID: nsIID = nsID(0x43ce1145, 0x30ef, 0x41a7,
[0xb9, 0x7d, 0xfa, 0x79, 0x7f, 0x7f, 0x7d, 0x18]);
}
// 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 nsIWebTransportReceiveStreamStats {
#[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 nsIWebTransportReceiveStreamStats.
// 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 nsIWebTransportReceiveStreamStatsCoerce {
/// Cheaply cast a value of this type from a `nsIWebTransportReceiveStreamStats`.
fn coerce_from(v: &nsIWebTransportReceiveStreamStats) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIWebTransportReceiveStreamStatsCoerce for nsIWebTransportReceiveStreamStats {
#[inline]
fn coerce_from(v: &nsIWebTransportReceiveStreamStats) -> &Self {
v
}
}
impl nsIWebTransportReceiveStreamStats {
/// Cast this `nsIWebTransportReceiveStreamStats` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIWebTransportReceiveStreamStatsCoerce>(&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 nsIWebTransportReceiveStreamStats {
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> nsIWebTransportReceiveStreamStatsCoerce for T {
#[inline]
fn coerce_from(v: &nsIWebTransportReceiveStreamStats) -> &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 nsIWebTransportReceiveStreamStats
// 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 nsIWebTransportReceiveStreamStatsVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* [noscript] readonly attribute TimeStamp timestamp; */
/// Unable to generate binding because `Rust only supports [ref] / [ptr] native types`
pub GetTimestamp: *const ::libc::c_void,
/* readonly attribute unsigned long long bytesReceived; */
pub GetBytesReceived: unsafe extern "system" fn (this: *const nsIWebTransportReceiveStreamStats, aBytesReceived: *mut u64) -> ::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 nsIWebTransportReceiveStreamStats {
/// `[noscript] readonly attribute TimeStamp timestamp;`
const _GetTimestamp: () = ();
/// `readonly attribute unsigned long long bytesReceived;`
#[inline]
pub unsafe fn GetBytesReceived(&self, aBytesReceived: *mut u64) -> ::nserror::nsresult {
((*self.vtable).GetBytesReceived)(self, aBytesReceived)
}
}
/// `interface nsIWebTransportStreamStatsCallback : 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 nsIWebTransportStreamStatsCallback {
vtable: &'static nsIWebTransportStreamStatsCallbackVTable,
/// 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 nsIWebTransportStreamStatsCallback.
unsafe impl XpCom for nsIWebTransportStreamStatsCallback {
const IID: nsIID = nsID(0x9c1df3f5, 0xbf04, 0x46b6,
[0x99, 0x77, 0xeb, 0x63, 0x89, 0x07, 0x6d, 0xb8]);
}
// 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 nsIWebTransportStreamStatsCallback {
#[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 nsIWebTransportStreamStatsCallback.
// 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 nsIWebTransportStreamStatsCallbackCoerce {
/// Cheaply cast a value of this type from a `nsIWebTransportStreamStatsCallback`.
fn coerce_from(v: &nsIWebTransportStreamStatsCallback) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIWebTransportStreamStatsCallbackCoerce for nsIWebTransportStreamStatsCallback {
#[inline]
fn coerce_from(v: &nsIWebTransportStreamStatsCallback) -> &Self {
v
}
}
impl nsIWebTransportStreamStatsCallback {
/// Cast this `nsIWebTransportStreamStatsCallback` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIWebTransportStreamStatsCallbackCoerce>(&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 nsIWebTransportStreamStatsCallback {
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> nsIWebTransportStreamStatsCallbackCoerce for T {
#[inline]
fn coerce_from(v: &nsIWebTransportStreamStatsCallback) -> &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 nsIWebTransportStreamStatsCallback
// 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 nsIWebTransportStreamStatsCallbackVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void onSendStatsAvailable (in nsIWebTransportSendStreamStats aStats); */
pub OnSendStatsAvailable: unsafe extern "system" fn (this: *const nsIWebTransportStreamStatsCallback, aStats: *const nsIWebTransportSendStreamStats) -> ::nserror::nsresult,
/* void onReceiveStatsAvailable (in nsIWebTransportReceiveStreamStats aStats); */
pub OnReceiveStatsAvailable: unsafe extern "system" fn (this: *const nsIWebTransportStreamStatsCallback, aStats: *const nsIWebTransportReceiveStreamStats) -> ::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 nsIWebTransportStreamStatsCallback {
/// `void onSendStatsAvailable (in nsIWebTransportSendStreamStats aStats);`
#[inline]
pub unsafe fn OnSendStatsAvailable(&self, aStats: *const nsIWebTransportSendStreamStats) -> ::nserror::nsresult {
((*self.vtable).OnSendStatsAvailable)(self, aStats)
}
/// `void onReceiveStatsAvailable (in nsIWebTransportReceiveStreamStats aStats);`
#[inline]
pub unsafe fn OnReceiveStatsAvailable(&self, aStats: *const nsIWebTransportReceiveStreamStats) -> ::nserror::nsresult {
((*self.vtable).OnReceiveStatsAvailable)(self, aStats)
}
}
/// `interface nsIWebTransportReceiveStream : 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 nsIWebTransportReceiveStream {
vtable: &'static nsIWebTransportReceiveStreamVTable,
/// 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 nsIWebTransportReceiveStream.
unsafe impl XpCom for nsIWebTransportReceiveStream {
const IID: nsIID = nsID(0xd461b235, 0x6291, 0x4817,
[0xad, 0xcc, 0xa2, 0xa3, 0xb3, 0xdf, 0xc1, 0x0b]);
}
// 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 nsIWebTransportReceiveStream {
#[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 nsIWebTransportReceiveStream.
// 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 nsIWebTransportReceiveStreamCoerce {
/// Cheaply cast a value of this type from a `nsIWebTransportReceiveStream`.
fn coerce_from(v: &nsIWebTransportReceiveStream) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIWebTransportReceiveStreamCoerce for nsIWebTransportReceiveStream {
#[inline]
fn coerce_from(v: &nsIWebTransportReceiveStream) -> &Self {
v
}
}
impl nsIWebTransportReceiveStream {
/// Cast this `nsIWebTransportReceiveStream` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIWebTransportReceiveStreamCoerce>(&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 nsIWebTransportReceiveStream {
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> nsIWebTransportReceiveStreamCoerce for T {
#[inline]
fn coerce_from(v: &nsIWebTransportReceiveStream) -> &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 nsIWebTransportReceiveStream
// 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 nsIWebTransportReceiveStreamVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void sendStopSending (in uint8_t aError); */
pub SendStopSending: unsafe extern "system" fn (this: *const nsIWebTransportReceiveStream, aError: u8) -> ::nserror::nsresult,
/* void getReceiveStreamStats (in nsIWebTransportStreamStatsCallback aCallback); */
pub GetReceiveStreamStats: unsafe extern "system" fn (this: *const nsIWebTransportReceiveStream, aCallback: *const nsIWebTransportStreamStatsCallback) -> ::nserror::nsresult,
/* readonly attribute boolean hasReceivedFIN; */
pub GetHasReceivedFIN: unsafe extern "system" fn (this: *const nsIWebTransportReceiveStream, aHasReceivedFIN: *mut bool) -> ::nserror::nsresult,
/* readonly attribute nsIAsyncInputStream inputStream; */
pub GetInputStream: unsafe extern "system" fn (this: *const nsIWebTransportReceiveStream, aInputStream: *mut*const nsIAsyncInputStream) -> ::nserror::nsresult,
/* readonly attribute uint64_t streamId; */
pub GetStreamId: unsafe extern "system" fn (this: *const nsIWebTransportReceiveStream, aStreamId: *mut u64) -> ::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 nsIWebTransportReceiveStream {
/// `void sendStopSending (in uint8_t aError);`
#[inline]
pub unsafe fn SendStopSending(&self, aError: u8) -> ::nserror::nsresult {
((*self.vtable).SendStopSending)(self, aError)
}
/// `void getReceiveStreamStats (in nsIWebTransportStreamStatsCallback aCallback);`
#[inline]
pub unsafe fn GetReceiveStreamStats(&self, aCallback: *const nsIWebTransportStreamStatsCallback) -> ::nserror::nsresult {
((*self.vtable).GetReceiveStreamStats)(self, aCallback)
}
/// `readonly attribute boolean hasReceivedFIN;`
#[inline]
pub unsafe fn GetHasReceivedFIN(&self, aHasReceivedFIN: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetHasReceivedFIN)(self, aHasReceivedFIN)
}
/// `readonly attribute nsIAsyncInputStream inputStream;`
#[inline]
pub unsafe fn GetInputStream(&self, aInputStream: *mut*const nsIAsyncInputStream) -> ::nserror::nsresult {
((*self.vtable).GetInputStream)(self, aInputStream)
}
/// `readonly attribute uint64_t streamId;`
#[inline]
pub unsafe fn GetStreamId(&self, aStreamId: *mut u64) -> ::nserror::nsresult {
((*self.vtable).GetStreamId)(self, aStreamId)
}
}
/// `interface nsIWebTransportSendStream : 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 nsIWebTransportSendStream {
vtable: &'static nsIWebTransportSendStreamVTable,
/// 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 nsIWebTransportSendStream.
unsafe impl XpCom for nsIWebTransportSendStream {
const IID: nsIID = nsID(0x804f245c, 0x52ea, 0x403c,
[0x8a, 0x78, 0xf7, 0x51, 0x53, 0x3b, 0xdd, 0x70]);
}
// 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 nsIWebTransportSendStream {
#[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 nsIWebTransportSendStream.
// 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 nsIWebTransportSendStreamCoerce {
/// Cheaply cast a value of this type from a `nsIWebTransportSendStream`.
fn coerce_from(v: &nsIWebTransportSendStream) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIWebTransportSendStreamCoerce for nsIWebTransportSendStream {
#[inline]
fn coerce_from(v: &nsIWebTransportSendStream) -> &Self {
v
}
}
impl nsIWebTransportSendStream {
/// Cast this `nsIWebTransportSendStream` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIWebTransportSendStreamCoerce>(&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 nsIWebTransportSendStream {
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> nsIWebTransportSendStreamCoerce for T {
#[inline]
fn coerce_from(v: &nsIWebTransportSendStream) -> &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 nsIWebTransportSendStream
// 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 nsIWebTransportSendStreamVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void sendFin (); */
pub SendFin: unsafe extern "system" fn (this: *const nsIWebTransportSendStream) -> ::nserror::nsresult,
/* void reset (in uint8_t aErrorCode); */
pub Reset: unsafe extern "system" fn (this: *const nsIWebTransportSendStream, aErrorCode: u8) -> ::nserror::nsresult,
/* void getSendStreamStats (in nsIWebTransportStreamStatsCallback aCallback); */
pub GetSendStreamStats: unsafe extern "system" fn (this: *const nsIWebTransportSendStream, aCallback: *const nsIWebTransportStreamStatsCallback) -> ::nserror::nsresult,
/* readonly attribute nsIAsyncOutputStream outputStream; */
pub GetOutputStream: unsafe extern "system" fn (this: *const nsIWebTransportSendStream, aOutputStream: *mut*const nsIAsyncOutputStream) -> ::nserror::nsresult,
/* readonly attribute uint64_t streamId; */
pub GetStreamId: unsafe extern "system" fn (this: *const nsIWebTransportSendStream, aStreamId: *mut u64) -> ::nserror::nsresult,
/* [noscript] void setSendOrder (in MaybeInt64 aSendOrder); */
/// Unable to generate binding because `Rust only supports [ref] / [ptr] native types`
pub SetSendOrder: *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 nsIWebTransportSendStream {
/// `void sendFin ();`
#[inline]
pub unsafe fn SendFin(&self, ) -> ::nserror::nsresult {
((*self.vtable).SendFin)(self, )
}
/// `void reset (in uint8_t aErrorCode);`
#[inline]
pub unsafe fn Reset(&self, aErrorCode: u8) -> ::nserror::nsresult {
((*self.vtable).Reset)(self, aErrorCode)
}
/// `void getSendStreamStats (in nsIWebTransportStreamStatsCallback aCallback);`
#[inline]
pub unsafe fn GetSendStreamStats(&self, aCallback: *const nsIWebTransportStreamStatsCallback) -> ::nserror::nsresult {
((*self.vtable).GetSendStreamStats)(self, aCallback)
}
/// `readonly attribute nsIAsyncOutputStream outputStream;`
#[inline]
pub unsafe fn GetOutputStream(&self, aOutputStream: *mut*const nsIAsyncOutputStream) -> ::nserror::nsresult {
((*self.vtable).GetOutputStream)(self, aOutputStream)
}
/// `readonly attribute uint64_t streamId;`
#[inline]
pub unsafe fn GetStreamId(&self, aStreamId: *mut u64) -> ::nserror::nsresult {
((*self.vtable).GetStreamId)(self, aStreamId)
}
/// `[noscript] void setSendOrder (in MaybeInt64 aSendOrder);`
const _SetSendOrder: () = ();
}
/// `interface nsIWebTransportBidirectionalStream : 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 nsIWebTransportBidirectionalStream {
vtable: &'static nsIWebTransportBidirectionalStreamVTable,
/// 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 nsIWebTransportBidirectionalStream.
unsafe impl XpCom for nsIWebTransportBidirectionalStream {
const IID: nsIID = nsID(0xf9ecb509, 0x36db, 0x4689,
[0x97, 0xd6, 0x13, 0x76, 0x39, 0xa0, 0x87, 0x50]);
}
// 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 nsIWebTransportBidirectionalStream {
#[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 nsIWebTransportBidirectionalStream.
// 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 nsIWebTransportBidirectionalStreamCoerce {
/// Cheaply cast a value of this type from a `nsIWebTransportBidirectionalStream`.
fn coerce_from(v: &nsIWebTransportBidirectionalStream) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIWebTransportBidirectionalStreamCoerce for nsIWebTransportBidirectionalStream {
#[inline]
fn coerce_from(v: &nsIWebTransportBidirectionalStream) -> &Self {
v
}
}
impl nsIWebTransportBidirectionalStream {
/// Cast this `nsIWebTransportBidirectionalStream` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIWebTransportBidirectionalStreamCoerce>(&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 nsIWebTransportBidirectionalStream {
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> nsIWebTransportBidirectionalStreamCoerce for T {
#[inline]
fn coerce_from(v: &nsIWebTransportBidirectionalStream) -> &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 nsIWebTransportBidirectionalStream
// 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 nsIWebTransportBidirectionalStreamVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void sendStopSending (in uint8_t aError); */
pub SendStopSending: unsafe extern "system" fn (this: *const nsIWebTransportBidirectionalStream, aError: u8) -> ::nserror::nsresult,
/* void sendFin (); */
pub SendFin: unsafe extern "system" fn (this: *const nsIWebTransportBidirectionalStream) -> ::nserror::nsresult,
/* void reset (in uint8_t aErrorCode); */
pub Reset: unsafe extern "system" fn (this: *const nsIWebTransportBidirectionalStream, aErrorCode: u8) -> ::nserror::nsresult,
/* readonly attribute boolean hasReceivedFIN; */
pub GetHasReceivedFIN: unsafe extern "system" fn (this: *const nsIWebTransportBidirectionalStream, aHasReceivedFIN: *mut bool) -> ::nserror::nsresult,
/* readonly attribute nsIAsyncInputStream inputStream; */
pub GetInputStream: unsafe extern "system" fn (this: *const nsIWebTransportBidirectionalStream, aInputStream: *mut*const nsIAsyncInputStream) -> ::nserror::nsresult,
/* readonly attribute nsIAsyncOutputStream outputStream; */
pub GetOutputStream: unsafe extern "system" fn (this: *const nsIWebTransportBidirectionalStream, aOutputStream: *mut*const nsIAsyncOutputStream) -> ::nserror::nsresult,
/* readonly attribute uint64_t streamId; */
pub GetStreamId: unsafe extern "system" fn (this: *const nsIWebTransportBidirectionalStream, aStreamId: *mut u64) -> ::nserror::nsresult,
/* [noscript] void setSendOrder (in MaybeInt64 aSendOrder); */
/// Unable to generate binding because `Rust only supports [ref] / [ptr] native types`
pub SetSendOrder: *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 nsIWebTransportBidirectionalStream {
/// `void sendStopSending (in uint8_t aError);`
#[inline]
pub unsafe fn SendStopSending(&self, aError: u8) -> ::nserror::nsresult {
((*self.vtable).SendStopSending)(self, aError)
}
/// `void sendFin ();`
#[inline]
pub unsafe fn SendFin(&self, ) -> ::nserror::nsresult {
((*self.vtable).SendFin)(self, )
}
/// `void reset (in uint8_t aErrorCode);`
#[inline]
pub unsafe fn Reset(&self, aErrorCode: u8) -> ::nserror::nsresult {
((*self.vtable).Reset)(self, aErrorCode)
}
/// `readonly attribute boolean hasReceivedFIN;`
#[inline]
pub unsafe fn GetHasReceivedFIN(&self, aHasReceivedFIN: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetHasReceivedFIN)(self, aHasReceivedFIN)
}
/// `readonly attribute nsIAsyncInputStream inputStream;`
#[inline]
pub unsafe fn GetInputStream(&self, aInputStream: *mut*const nsIAsyncInputStream) -> ::nserror::nsresult {
((*self.vtable).GetInputStream)(self, aInputStream)
}
/// `readonly attribute nsIAsyncOutputStream outputStream;`
#[inline]
pub unsafe fn GetOutputStream(&self, aOutputStream: *mut*const nsIAsyncOutputStream) -> ::nserror::nsresult {
((*self.vtable).GetOutputStream)(self, aOutputStream)
}
/// `readonly attribute uint64_t streamId;`
#[inline]
pub unsafe fn GetStreamId(&self, aStreamId: *mut u64) -> ::nserror::nsresult {
((*self.vtable).GetStreamId)(self, aStreamId)
}
/// `[noscript] void setSendOrder (in MaybeInt64 aSendOrder);`
const _SetSendOrder: () = ();
}