Trait surfman::connection::Connection

source ·
pub trait Connection: Sized {
    type Adapter;
    type Device;
    type NativeConnection;
    type NativeDevice;
    type NativeWidget;

    // Required methods
    fn new() -> Result<Self, Error>;
    fn native_connection(&self) -> Self::NativeConnection;
    fn gl_api(&self) -> GLApi;
    fn create_adapter(&self) -> Result<Self::Adapter, Error>;
    fn create_hardware_adapter(&self) -> Result<Self::Adapter, Error>;
    fn create_low_power_adapter(&self) -> Result<Self::Adapter, Error>;
    fn create_software_adapter(&self) -> Result<Self::Adapter, Error>;
    fn create_device(
        &self,
        adapter: &Self::Adapter,
    ) -> Result<Self::Device, Error>;
    unsafe fn create_device_from_native_device(
        &self,
        native_device: Self::NativeDevice,
    ) -> Result<Self::Device, Error>;
    fn from_display_handle(handle: DisplayHandle<'_>) -> Result<Self, Error>;
    unsafe fn create_native_widget_from_ptr(
        &self,
        raw: *mut c_void,
        size: Size2D<i32>,
    ) -> Self::NativeWidget;
    fn create_native_widget_from_window_handle(
        &self,
        window: WindowHandle<'_>,
        size: Size2D<i32>,
    ) -> Result<Self::NativeWidget, Error>;
}
Expand description

Methods relating to display server connections.

Required Associated Types§

source

type Adapter

The adapter type associated with this connection.

source

type Device

The device type associated with this connection.

source

type NativeConnection

The native type associated with this connection.

source

type NativeDevice

The native device type associated with this connection.

source

type NativeWidget

The native widget type associated with this connection.

Required Methods§

source

fn new() -> Result<Self, Error>

Connects to the default display.

source

fn native_connection(&self) -> Self::NativeConnection

Returns the native connection corresponding to this connection.

source

fn gl_api(&self) -> GLApi

Returns the OpenGL API flavor that this connection supports (OpenGL or OpenGL ES).

source

fn create_adapter(&self) -> Result<Self::Adapter, Error>

Returns the “best” adapter on this system, preferring high-performance hardware adapters.

This is an alias for Connection::create_hardware_adapter().

source

fn create_hardware_adapter(&self) -> Result<Self::Adapter, Error>

Returns the “best” adapter on this system, preferring high-performance hardware adapters.

source

fn create_low_power_adapter(&self) -> Result<Self::Adapter, Error>

Returns the “best” adapter on this system, preferring low-power hardware adapters.

source

fn create_software_adapter(&self) -> Result<Self::Adapter, Error>

Returns the “best” adapter on this system, preferring software adapters.

source

fn create_device(&self, adapter: &Self::Adapter) -> Result<Self::Device, Error>

Opens a device.

source

unsafe fn create_device_from_native_device( &self, native_device: Self::NativeDevice, ) -> Result<Self::Device, Error>

Wraps an existing native device type in a device.

source

fn from_display_handle(handle: DisplayHandle<'_>) -> Result<Self, Error>

Opens the display connection corresponding to the given DisplayHandle.

source

unsafe fn create_native_widget_from_ptr( &self, raw: *mut c_void, size: Size2D<i32>, ) -> Self::NativeWidget

Creates a native widget from a raw pointer

source

fn create_native_widget_from_window_handle( &self, window: WindowHandle<'_>, size: Size2D<i32>, ) -> Result<Self::NativeWidget, Error>

Create a native widget type from the given WindowHandle.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Connection for surfman::platform::unix::generic::connection::Connection

source§

impl Connection for surfman::platform::unix::wayland::connection::Connection

source§

impl Connection for surfman::platform::unix::x11::connection::Connection

source§

impl<Def, Alt> Connection for surfman::platform::generic::multi::connection::Connection<Def, Alt>
where Def: DeviceInterface, Alt: DeviceInterface, Def::Connection: ConnectionInterface<Device = Def>, Alt::Connection: ConnectionInterface<Device = Alt>,

§

type Adapter = Adapter<Def, Alt>

§

type Device = Device<Def, Alt>

§

type NativeConnection = NativeConnection<Def, Alt>

§

type NativeDevice = NativeDevice<Def, Alt>

§

type NativeWidget = NativeWidget<Def, Alt>