Skip to main content

Raw

Trait Raw 

Source
pub unsafe trait Raw: Sized {
    type Raw: Sized;

    // Required methods
    unsafe fn from_raw(raw: *mut Self::Raw) -> Self;
    unsafe fn from_raw_opt(raw: *mut Self::Raw) -> Option<Self>;
    fn into_raw(self) -> *mut Self::Raw;
    fn as_raw(&self) -> *mut Self::Raw;
}
Expand description

Allow conversion to/from raw (winapi) pointer types.

§⚠️ Safety ⚠️

Lots of code depends on implicit invariants of this trait for soundness:

Required Associated Types§

Source

type Raw: Sized

The raw underlying winapi type

Required Methods§

Source

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

Take ownership from a raw winapi type, panicing if raw is null.

§⚠️ Safety ⚠️
  • raw must either be null or a sane/valid instance of the type in question.
§Panics
  • If raw is null
Source

unsafe fn from_raw_opt(raw: *mut Self::Raw) -> Option<Self>

Take ownership from a raw winapi type, returning None if raw is null.

§⚠️ Safety ⚠️
  • raw must either be null or a sane/valid instance of the type in question.
Source

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

Give up / leak ownership into a raw winapi pointer type.

Source

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

Allow access as a raw winapi pointer type.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl Raw for BaseTexture

Source§

impl Raw for CubeTexture

Source§

impl Raw for Device

Source§

impl Raw for DeviceEx

Source§

impl Raw for Direct3D

Source§

impl Raw for Direct3DEx

Source§

impl Raw for FunctionLinkingGraph

Source§

impl Raw for IndexBuffer

Source§

impl Raw for LibraryReflection

Source§

impl Raw for Linker

Source§

impl Raw for LinkingNode

Source§

impl Raw for Module

Source§

impl Raw for ModuleInstance

Source§

impl Raw for PixelShader

Source§

impl Raw for Query

Source§

impl Raw for ReadOnlyBlob

Source§

impl Raw for Resource

Source§

impl Raw for ShaderReflection

Source§

impl Raw for StateBlock

Source§

impl Raw for Surface

Source§

impl Raw for SwapChain

Source§

impl Raw for SwapChainEx

Source§

impl Raw for Texture

Source§

impl Raw for Unknown

Source§

impl Raw for VertexBuffer

Source§

impl Raw for VertexDeclaration

Source§

impl Raw for VertexShader

Source§

impl Raw for Volume

Source§

impl Raw for VolumeTexture