Skip to main content

Interface

Trait Interface 

Source
pub unsafe trait Interface: Sized {
    type Impl;
    type Vtable;

    const IID: &'static str;

    // Provided methods
    unsafe fn from_raw(raw: *mut Self::Impl) -> Self { ... }
    fn into_raw(self) -> *mut Self::Impl { ... }
    fn as_raw(&self) -> *mut Self::Impl { ... }
    fn cast<I: Interface>(&self) -> Result<I> { ... }
}
Expand description

§Safety

All unsafe implementers of this trait should guarantee ffi::IADLXInterface is the base type.

The struct must have the same layout as *mut IADLXInterface, preferably in terms of InterfaceImpl for automatic refcount management.

Required Associated Constants§

Source

const IID: &'static str

Required Associated Types§

Provided Methods§

Source

unsafe fn from_raw(raw: *mut Self::Impl) -> Self

Creates an Interface by taking ownership of the raw COM/ADLX interface pointer.

§Safety

The raw pointer must be owned by the caller and represent a valid ADLX interface pointer. In other words, it must point to a vtable beginning with the ffi::IADLXInterfaceVtbl function pointers and match the vtable of Self::Vtable.

Source

fn into_raw(self) -> *mut Self::Impl

Returns the raw COM/ADLX interface pointer and abandons ownership. It is the caller’s responsibility to release the COM/ADLX interface pointer.

Source

fn as_raw(&self) -> *mut Self::Impl

Returns the raw COM/ADLX interface pointer. The resulting pointer continues to be owned by the Interface implementation.

Source

fn cast<I: Interface>(&self) -> Result<I>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Interface for Gpu

Source§

const IID: &'static str = "IADLXGPU"

Source§

type Impl = IADLXGPU

Source§

type Vtable = IADLXGPUVtbl

Source§

impl Interface for Gpu1

Source§

const IID: &'static str = "IADLXGPU1"

Source§

type Impl = IADLXGPU1

Source§

type Vtable = IADLXGPU1Vtbl

Source§

impl Interface for GpuList

Source§

const IID: &'static str = "IADLXGPUList"

Source§

type Impl = IADLXGPUList

Source§

type Vtable = IADLXGPUListVtbl

Source§

impl Interface for GpuMetrics

Source§

const IID: &'static str = "IADLXGPUMetrics"

Source§

type Impl = IADLXGPUMetrics

Source§

type Vtable = IADLXGPUMetricsVtbl

Source§

impl Interface for GpuMetricsList

Source§

const IID: &'static str = "IADLXGpuMetricsList"

Source§

type Impl = IADLXGPUMetricsList

Source§

type Vtable = IADLXGPUMetricsListVtbl

Source§

impl Interface for GpuMetricsSupport

Source§

const IID: &'static str = "IADLXGpuMetricsSupport"

Source§

type Impl = IADLXGPUMetricsSupport

Source§

type Vtable = IADLXGPUMetricsSupportVtbl

Source§

impl Interface for InterfaceImpl

Source§

const IID: &'static str = "IADLXInterface"

Source§

type Impl = IADLXInterface

Source§

type Vtable = IADLXInterfaceVtbl

Source§

impl Interface for List

Source§

const IID: &'static str = "IADLXList"

Source§

type Impl = IADLXList

Source§

type Vtable = IADLXListVtbl

Source§

impl Interface for PerformanceMonitoringServices

Source§

impl Interface for System1

Source§

const IID: &'static str = "IADLXSystem1"

Source§

type Impl = IADLXSystem1

Source§

type Vtable = IADLXSystem1Vtbl