//
// DO NOT EDIT. THIS FILE IS GENERATED FROM $SRCDIR/toolkit/components/content-classifier/nsIContentClassifierService.idl
//
/// `interface nsIContentClassifierProbeRequest : nsISupports`
///
/// ```text
/// /**
/// * Interface used to probe the active content classification
/// * engines. This contains enough information to define a
/// * request uniquely. requestType should be one of the types
/// * accepted by the underlying Rust crate.
/// *
/// * These are not used internally to save an nsISupports
/// * construction on every network request. Currently only
/// * used by the about:url-classifier.
/// */
/// ```
///
// 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 nsIContentClassifierProbeRequest {
vtable: &'static nsIContentClassifierProbeRequestVTable,
/// 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 nsIContentClassifierProbeRequest.
unsafe impl XpCom for nsIContentClassifierProbeRequest {
const IID: nsIID = nsID(0xa229970f, 0x205f, 0x48fd,
[0x9e, 0xaf, 0xa2, 0xf8, 0xaa, 0x8a, 0x0e, 0x4f]);
}
// 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 nsIContentClassifierProbeRequest {
#[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 nsIContentClassifierProbeRequest.
// 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 nsIContentClassifierProbeRequestCoerce {
/// Cheaply cast a value of this type from a `nsIContentClassifierProbeRequest`.
fn coerce_from(v: &nsIContentClassifierProbeRequest) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIContentClassifierProbeRequestCoerce for nsIContentClassifierProbeRequest {
#[inline]
fn coerce_from(v: &nsIContentClassifierProbeRequest) -> &Self {
v
}
}
impl nsIContentClassifierProbeRequest {
/// Cast this `nsIContentClassifierProbeRequest` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIContentClassifierProbeRequestCoerce>(&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 nsIContentClassifierProbeRequest {
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> nsIContentClassifierProbeRequestCoerce for T {
#[inline]
fn coerce_from(v: &nsIContentClassifierProbeRequest) -> &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 nsIContentClassifierProbeRequest
// 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 nsIContentClassifierProbeRequestVTable {
/// 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 url; */
pub GetUrl: unsafe extern "system" fn (this: *const nsIContentClassifierProbeRequest, aUrl: *mut ::nsstring::nsACString) -> ::nserror::nsresult,
/* readonly attribute ACString sourceUrl; */
pub GetSourceUrl: unsafe extern "system" fn (this: *const nsIContentClassifierProbeRequest, aSourceUrl: *mut ::nsstring::nsACString) -> ::nserror::nsresult,
/* readonly attribute ACString topWindowUrl; */
pub GetTopWindowUrl: unsafe extern "system" fn (this: *const nsIContentClassifierProbeRequest, aTopWindowUrl: *mut ::nsstring::nsACString) -> ::nserror::nsresult,
/* readonly attribute ACString requestType; */
pub GetRequestType: unsafe extern "system" fn (this: *const nsIContentClassifierProbeRequest, aRequestType: *mut ::nsstring::nsACString) -> ::nserror::nsresult,
/* readonly attribute boolean privateBrowsing; */
pub GetPrivateBrowsing: unsafe extern "system" fn (this: *const nsIContentClassifierProbeRequest, aPrivateBrowsing: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean forceThirdPartyToTop; */
pub GetForceThirdPartyToTop: unsafe extern "system" fn (this: *const nsIContentClassifierProbeRequest, aForceThirdPartyToTop: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean isNonRecommendedAddon; */
pub GetIsNonRecommendedAddon: unsafe extern "system" fn (this: *const nsIContentClassifierProbeRequest, aIsNonRecommendedAddon: *mut bool) -> ::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 nsIContentClassifierProbeRequest {
/// `readonly attribute ACString url;`
#[inline]
pub unsafe fn GetUrl(&self, aUrl: *mut ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).GetUrl)(self, aUrl)
}
/// `readonly attribute ACString sourceUrl;`
#[inline]
pub unsafe fn GetSourceUrl(&self, aSourceUrl: *mut ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).GetSourceUrl)(self, aSourceUrl)
}
/// `readonly attribute ACString topWindowUrl;`
#[inline]
pub unsafe fn GetTopWindowUrl(&self, aTopWindowUrl: *mut ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).GetTopWindowUrl)(self, aTopWindowUrl)
}
/// `readonly attribute ACString requestType;`
#[inline]
pub unsafe fn GetRequestType(&self, aRequestType: *mut ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).GetRequestType)(self, aRequestType)
}
/// `readonly attribute boolean privateBrowsing;`
#[inline]
pub unsafe fn GetPrivateBrowsing(&self, aPrivateBrowsing: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetPrivateBrowsing)(self, aPrivateBrowsing)
}
/// `readonly attribute boolean forceThirdPartyToTop;`
#[inline]
pub unsafe fn GetForceThirdPartyToTop(&self, aForceThirdPartyToTop: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetForceThirdPartyToTop)(self, aForceThirdPartyToTop)
}
/// `readonly attribute boolean isNonRecommendedAddon;`
#[inline]
pub unsafe fn GetIsNonRecommendedAddon(&self, aIsNonRecommendedAddon: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetIsNonRecommendedAddon)(self, aIsNonRecommendedAddon)
}
}
/// `interface nsIContentClassifierProbeResult : nsISupports`
///
/// ```text
/// /**
/// * Interface used to get results from an active content
/// * classification engine. If you want a combined verdict
/// * from multiple engines, see
/// * nsIContentClassifierService_ProbeStatus.
/// *
/// * These are not used internally to save an nsISupports
/// * construction on every network request. Currently only
/// * used by the about:url-classifier.
/// */
/// ```
///
// 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 nsIContentClassifierProbeResult {
vtable: &'static nsIContentClassifierProbeResultVTable,
/// 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 nsIContentClassifierProbeResult.
unsafe impl XpCom for nsIContentClassifierProbeResult {
const IID: nsIID = nsID(0x2b0f5d14, 0x3d44, 0x4f9a,
[0x9f, 0xb8, 0xa8, 0xd9, 0xc9, 0xf6, 0xd9, 0x21]);
}
// 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 nsIContentClassifierProbeResult {
#[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 nsIContentClassifierProbeResult.
// 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 nsIContentClassifierProbeResultCoerce {
/// Cheaply cast a value of this type from a `nsIContentClassifierProbeResult`.
fn coerce_from(v: &nsIContentClassifierProbeResult) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIContentClassifierProbeResultCoerce for nsIContentClassifierProbeResult {
#[inline]
fn coerce_from(v: &nsIContentClassifierProbeResult) -> &Self {
v
}
}
impl nsIContentClassifierProbeResult {
/// Cast this `nsIContentClassifierProbeResult` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIContentClassifierProbeResultCoerce>(&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 nsIContentClassifierProbeResult {
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> nsIContentClassifierProbeResultCoerce for T {
#[inline]
fn coerce_from(v: &nsIContentClassifierProbeResult) -> &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 nsIContentClassifierProbeResult
// 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 nsIContentClassifierProbeResultVTable {
/// 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 featureName; */
pub GetFeatureName: unsafe extern "system" fn (this: *const nsIContentClassifierProbeResult, aFeatureName: *mut ::nsstring::nsACString) -> ::nserror::nsresult,
/* readonly attribute boolean matched; */
pub GetMatched: unsafe extern "system" fn (this: *const nsIContentClassifierProbeResult, aMatched: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean exception; */
pub GetException: unsafe extern "system" fn (this: *const nsIContentClassifierProbeResult, aException: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean important; */
pub GetImportant: unsafe extern "system" fn (this: *const nsIContentClassifierProbeResult, aImportant: *mut bool) -> ::nserror::nsresult,
/* readonly attribute nsresult engineResult; */
pub GetEngineResult: unsafe extern "system" fn (this: *const nsIContentClassifierProbeResult, aEngineResult: *mut nserror::nsresult) -> ::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 nsIContentClassifierProbeResult {
/// `readonly attribute ACString featureName;`
#[inline]
pub unsafe fn GetFeatureName(&self, aFeatureName: *mut ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).GetFeatureName)(self, aFeatureName)
}
/// `readonly attribute boolean matched;`
#[inline]
pub unsafe fn GetMatched(&self, aMatched: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetMatched)(self, aMatched)
}
/// `readonly attribute boolean exception;`
#[inline]
pub unsafe fn GetException(&self, aException: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetException)(self, aException)
}
/// `readonly attribute boolean important;`
#[inline]
pub unsafe fn GetImportant(&self, aImportant: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetImportant)(self, aImportant)
}
/// `readonly attribute nsresult engineResult;`
#[inline]
pub unsafe fn GetEngineResult(&self, aEngineResult: *mut nserror::nsresult) -> ::nserror::nsresult {
((*self.vtable).GetEngineResult)(self, aEngineResult)
}
}
/// `interface nsIContentClassifierService : nsISupports`
///
/// ```text
/// /**
/// * Interface for the content classifier service. Used by the JS
/// * RemoteSettings client to notify the C++ service of filter list
/// * additions, updates, and removals. The service pulls the actual
/// * bytes back from the client on demand via getListBytes().
/// */
/// ```
///
// 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 nsIContentClassifierService {
vtable: &'static nsIContentClassifierServiceVTable,
/// 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 nsIContentClassifierService.
unsafe impl XpCom for nsIContentClassifierService {
const IID: nsIID = nsID(0x1afc121b, 0x6849, 0x4ba4,
[0xa5, 0x15, 0xc7, 0xe9, 0x1f, 0x20, 0xd0, 0xdc]);
}
// 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 nsIContentClassifierService {
#[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 nsIContentClassifierService.
// 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 nsIContentClassifierServiceCoerce {
/// Cheaply cast a value of this type from a `nsIContentClassifierService`.
fn coerce_from(v: &nsIContentClassifierService) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIContentClassifierServiceCoerce for nsIContentClassifierService {
#[inline]
fn coerce_from(v: &nsIContentClassifierService) -> &Self {
v
}
}
impl nsIContentClassifierService {
/// Cast this `nsIContentClassifierService` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIContentClassifierServiceCoerce>(&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 nsIContentClassifierService {
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> nsIContentClassifierServiceCoerce for T {
#[inline]
fn coerce_from(v: &nsIContentClassifierService) -> &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 nsIContentClassifierService
// 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 nsIContentClassifierServiceVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void onListsChanged (in Array<ACString> aUpdated, in Array<ACString> aRemoved); */
pub OnListsChanged: unsafe extern "system" fn (this: *const nsIContentClassifierService, aUpdated: *const thin_vec::ThinVec<::nsstring::nsCString>, aRemoved: *const thin_vec::ThinVec<::nsstring::nsCString>) -> ::nserror::nsresult,
/* Array<ACString> getFeatureNames (); */
pub GetFeatureNames: unsafe extern "system" fn (this: *const nsIContentClassifierService, _retval: *mut thin_vec::ThinVec<::nsstring::nsCString>) -> ::nserror::nsresult,
/* [implicit_jscontext] Promise probeBlocking (in nsIContentClassifierProbeRequest aRequest); */
/// Unable to generate binding because `jscontext is unsupported`
pub ProbeBlocking: *const ::libc::c_void,
/* [implicit_jscontext] Promise probeAnnotate (in nsIContentClassifierProbeRequest aRequest); */
/// Unable to generate binding because `jscontext is unsupported`
pub ProbeAnnotate: *const ::libc::c_void,
/* [implicit_jscontext] Promise probeFeature (in ACString aFeatureName, in nsIContentClassifierProbeRequest aRequest); */
/// Unable to generate binding because `jscontext is unsupported`
pub ProbeFeature: *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 nsIContentClassifierService {
pub const Miss: u8 = 0;
pub const Hit: u8 = 1;
pub const Exception: u8 = 2;
pub const ImportantHit: u8 = 3;
pub const ImportantException: u8 = 4;
/// ```text
/// /**
/// * Notify the service of a batch of list changes. `aUpdated` lists
/// * are (re)built by pulling fresh bytes from the RemoteSettings
/// * client; `aRemoved` lists are dropped and any feature engine
/// * referencing them is rebuilt without that list (or dropped
/// * entirely if it has no remaining lists). The service kicks off a
/// * single async rebuild for the union of affected features and
/// * fires NS_CONTENT_CLASSIFIER_FILTER_LISTS_LOADED_TOPIC once the
/// * rebuild has settled. Safe to call with empty arrays (the topic
/// * still fires).
/// */
/// ```
///
/// `void onListsChanged (in Array<ACString> aUpdated, in Array<ACString> aRemoved);`
#[inline]
pub unsafe fn OnListsChanged(&self, aUpdated: *const thin_vec::ThinVec<::nsstring::nsCString>, aRemoved: *const thin_vec::ThinVec<::nsstring::nsCString>) -> ::nserror::nsresult {
((*self.vtable).OnListsChanged)(self, aUpdated, aRemoved)
}
/// ```text
/// /**
/// * Return the names of the content classifier features defined in
/// * the static feature table. Each name identifies a feature whose
/// * filter list IDs are grouped into a single classification engine.
/// */
/// ```
///
/// `Array<ACString> getFeatureNames ();`
#[inline]
pub unsafe fn GetFeatureNames(&self, _retval: *mut thin_vec::ThinVec<::nsstring::nsCString>) -> ::nserror::nsresult {
((*self.vtable).GetFeatureNames)(self, _retval)
}
/// ```text
/// /**
/// * Return the results of testing if a request would be blocked.
/// * Used for about:url-classifier. Resolves with an
/// * nsIContentClassifierProbeReport.
/// */
/// ```
///
/// `[implicit_jscontext] Promise probeBlocking (in nsIContentClassifierProbeRequest aRequest);`
const _ProbeBlocking: () = ();
/// ```text
/// /**
/// * Return the results of testing if a request would be annotated
/// * as a tracker. Used for about:url-classifier. Resolves with an
/// * nsIContentClassifierProbeReport.
/// */
/// ```
///
/// `[implicit_jscontext] Promise probeAnnotate (in nsIContentClassifierProbeRequest aRequest);`
const _ProbeAnnotate: () = ();
/// ```text
/// /**
/// * Return the results of testing if a request would match a
/// * particular feature. Used for about:url-classifier. Resolves with
/// * an nsIContentClassifierProbeResult.
/// */
/// ```
///
/// `[implicit_jscontext] Promise probeFeature (in ACString aFeatureName, in nsIContentClassifierProbeRequest aRequest);`
const _ProbeFeature: () = ();
}
/// `interface nsIContentClassifierProbeReport : nsISupports`
///
/// ```text
/// /**
/// * Aggregated report from a probeBlocking / probeAnnotate call: the
/// * per-engine results plus the combined ProbeStatus verdict.
/// */
/// ```
///
// 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 nsIContentClassifierProbeReport {
vtable: &'static nsIContentClassifierProbeReportVTable,
/// 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 nsIContentClassifierProbeReport.
unsafe impl XpCom for nsIContentClassifierProbeReport {
const IID: nsIID = nsID(0xf5c1c07e, 0x1b8d, 0x4fbd,
[0x9d, 0xf5, 0x1c, 0x1b, 0x0d, 0xfb, 0x2d, 0x61]);
}
// 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 nsIContentClassifierProbeReport {
#[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 nsIContentClassifierProbeReport.
// 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 nsIContentClassifierProbeReportCoerce {
/// Cheaply cast a value of this type from a `nsIContentClassifierProbeReport`.
fn coerce_from(v: &nsIContentClassifierProbeReport) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIContentClassifierProbeReportCoerce for nsIContentClassifierProbeReport {
#[inline]
fn coerce_from(v: &nsIContentClassifierProbeReport) -> &Self {
v
}
}
impl nsIContentClassifierProbeReport {
/// Cast this `nsIContentClassifierProbeReport` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIContentClassifierProbeReportCoerce>(&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 nsIContentClassifierProbeReport {
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> nsIContentClassifierProbeReportCoerce for T {
#[inline]
fn coerce_from(v: &nsIContentClassifierProbeReport) -> &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 nsIContentClassifierProbeReport
// 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 nsIContentClassifierProbeReportVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* readonly attribute nsIContentClassifierService_ProbeStatus status; */
pub GetStatus: unsafe extern "system" fn (this: *const nsIContentClassifierProbeReport, aStatus: *mut u8) -> ::nserror::nsresult,
/* readonly attribute Array<nsIContentClassifierProbeResult> results; */
pub GetResults: unsafe extern "system" fn (this: *const nsIContentClassifierProbeReport, aResults: *mut thin_vec::ThinVec<Option<RefPtr<nsIContentClassifierProbeResult>>>) -> ::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 nsIContentClassifierProbeReport {
/// `readonly attribute nsIContentClassifierService_ProbeStatus status;`
#[inline]
pub unsafe fn GetStatus(&self, aStatus: *mut u8) -> ::nserror::nsresult {
((*self.vtable).GetStatus)(self, aStatus)
}
/// `readonly attribute Array<nsIContentClassifierProbeResult> results;`
#[inline]
pub unsafe fn GetResults(&self, aResults: *mut thin_vec::ThinVec<Option<RefPtr<nsIContentClassifierProbeResult>>>) -> ::nserror::nsresult {
((*self.vtable).GetResults)(self, aResults)
}
}