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§
sourcetype NativeConnection
type NativeConnection
The native type associated with this connection.
sourcetype NativeDevice
type NativeDevice
The native device type associated with this connection.
sourcetype NativeWidget
type NativeWidget
The native widget type associated with this connection.
Required Methods§
sourcefn native_connection(&self) -> Self::NativeConnection
fn native_connection(&self) -> Self::NativeConnection
Returns the native connection corresponding to this connection.
sourcefn gl_api(&self) -> GLApi
fn gl_api(&self) -> GLApi
Returns the OpenGL API flavor that this connection supports (OpenGL or OpenGL ES).
sourcefn create_adapter(&self) -> Result<Self::Adapter, Error>
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()
.
sourcefn create_hardware_adapter(&self) -> Result<Self::Adapter, Error>
fn create_hardware_adapter(&self) -> Result<Self::Adapter, Error>
Returns the “best” adapter on this system, preferring high-performance hardware adapters.
sourcefn create_low_power_adapter(&self) -> Result<Self::Adapter, Error>
fn create_low_power_adapter(&self) -> Result<Self::Adapter, Error>
Returns the “best” adapter on this system, preferring low-power hardware adapters.
sourcefn create_software_adapter(&self) -> Result<Self::Adapter, Error>
fn create_software_adapter(&self) -> Result<Self::Adapter, Error>
Returns the “best” adapter on this system, preferring software adapters.
sourcefn create_device(&self, adapter: &Self::Adapter) -> Result<Self::Device, Error>
fn create_device(&self, adapter: &Self::Adapter) -> Result<Self::Device, Error>
Opens a device.
sourceunsafe fn create_device_from_native_device(
&self,
native_device: Self::NativeDevice,
) -> Result<Self::Device, Error>
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.
sourcefn from_display_handle(handle: DisplayHandle<'_>) -> Result<Self, Error>
fn from_display_handle(handle: DisplayHandle<'_>) -> Result<Self, Error>
Opens the display connection corresponding to the given DisplayHandle
.
sourceunsafe fn create_native_widget_from_ptr(
&self,
raw: *mut c_void,
size: Size2D<i32>,
) -> Self::NativeWidget
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
sourcefn create_native_widget_from_window_handle(
&self,
window: WindowHandle<'_>,
size: Size2D<i32>,
) -> Result<Self::NativeWidget, Error>
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
.