1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
use crate::Error;
use crate::GLApi;
use euclid::default::Size2D;
use std::os::raw::c_void;
#[cfg(feature = "sm-winit")]
use winit::Window;
pub trait Connection: Sized {
type Adapter;
type Device;
type NativeConnection;
type NativeDevice;
type NativeWidget;
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>;
#[cfg(feature = "sm-winit")]
fn from_winit_window(window: &Window) -> Result<Self, Error>;
#[cfg(feature = "sm-winit")]
fn create_native_widget_from_winit_window(&self, window: &Window)
-> Result<Self::NativeWidget, Error>;
unsafe fn create_native_widget_from_ptr(&self, raw: *mut c_void, size: Size2D<i32>) -> Self::NativeWidget;
#[cfg(feature = "sm-raw-window-handle")]
fn create_native_widget_from_rwh(&self, window: raw_window_handle::RawWindowHandle)
-> Result<Self::NativeWidget, Error>;
}