Enum surfman::platform::generic::multi::connection::Connection
source · pub enum Connection<Def, Alt>where
Def: DeviceInterface,
Alt: DeviceInterface,
Def::Connection: ConnectionInterface,
Alt::Connection: ConnectionInterface,{
Default(Def::Connection),
Alternate(Alt::Connection),
}
Expand description
A connection to the display server.
Variants§
Default(Def::Connection)
The default connection to the display server.
Alternate(Alt::Connection)
The alternate connection to the display server.
Implementations§
source§impl<Def, Alt> Connection<Def, Alt>where
Def: DeviceInterface,
Alt: DeviceInterface,
Def::Connection: ConnectionInterface<Device = Def>,
Alt::Connection: ConnectionInterface<Device = Alt>,
impl<Def, Alt> Connection<Def, Alt>where
Def: DeviceInterface,
Alt: DeviceInterface,
Def::Connection: ConnectionInterface<Device = Def>,
Alt::Connection: ConnectionInterface<Device = Alt>,
sourcepub fn new() -> Result<Connection<Def, Alt>, Error>
pub fn new() -> Result<Connection<Def, Alt>, Error>
Connects to the default display.
sourcepub fn native_connection(&self) -> NativeConnection<Def, Alt>
pub fn native_connection(&self) -> NativeConnection<Def, Alt>
Returns the native connection corresponding to this connection.
sourcepub fn gl_api(&self) -> GLApi
pub fn gl_api(&self) -> GLApi
Returns the OpenGL API flavor that this connection supports (OpenGL or OpenGL ES).
sourcepub fn create_adapter(&self) -> Result<Adapter<Def, Alt>, Error>
pub fn create_adapter(&self) -> Result<Adapter<Def, Alt>, Error>
Returns the “best” adapter on this system.
This is an alias for Connection::create_hardware_adapter()
.
sourcepub fn create_hardware_adapter(&self) -> Result<Adapter<Def, Alt>, Error>
pub fn create_hardware_adapter(&self) -> Result<Adapter<Def, Alt>, Error>
Returns the “best” adapter on this system, preferring high-performance hardware adapters.
sourcepub fn create_low_power_adapter(&self) -> Result<Adapter<Def, Alt>, Error>
pub fn create_low_power_adapter(&self) -> Result<Adapter<Def, Alt>, Error>
Returns the “best” adapter on this system, preferring low-power hardware adapters.
sourcepub fn create_software_adapter(&self) -> Result<Adapter<Def, Alt>, Error>
pub fn create_software_adapter(&self) -> Result<Adapter<Def, Alt>, Error>
Returns the “best” adapter on this system, preferring software adapters.
sourcepub fn create_device(
&self,
adapter: &Adapter<Def, Alt>,
) -> Result<Device<Def, Alt>, Error>
pub fn create_device( &self, adapter: &Adapter<Def, Alt>, ) -> Result<Device<Def, Alt>, Error>
Opens the hardware device corresponding to the given adapter.
Device handles are local to a single thread.
sourcepub unsafe fn create_device_from_native_device(
&self,
native_device: NativeDevice<Def, Alt>,
) -> Result<Device<Def, Alt>, Error>
pub unsafe fn create_device_from_native_device( &self, native_device: NativeDevice<Def, Alt>, ) -> Result<Device<Def, Alt>, Error>
Wraps a native device in a device.
sourcepub fn from_display_handle(
handle: DisplayHandle<'_>,
) -> Result<Connection<Def, Alt>, Error>
pub fn from_display_handle( handle: DisplayHandle<'_>, ) -> Result<Connection<Def, Alt>, Error>
Opens the display connection corresponding to the given DisplayHandle
.
sourcepub unsafe fn create_native_widget_from_ptr(
&self,
raw: *mut c_void,
size: Size2D<i32>,
) -> NativeWidget<Def, Alt>
pub unsafe fn create_native_widget_from_ptr( &self, raw: *mut c_void, size: Size2D<i32>, ) -> NativeWidget<Def, Alt>
Create a native widget from a raw pointer
sourcepub fn create_native_widget_from_window_handle(
&self,
handle: WindowHandle<'_>,
size: Size2D<i32>,
) -> Result<NativeWidget<Def, Alt>, Error>
pub fn create_native_widget_from_window_handle( &self, handle: WindowHandle<'_>, size: Size2D<i32>, ) -> Result<NativeWidget<Def, Alt>, Error>
Create a native widget type from the given WindowHandle
.
Trait Implementations§
source§impl<Def, Alt> Clone for Connection<Def, Alt>
impl<Def, Alt> Clone for Connection<Def, Alt>
source§impl<Def, Alt> Connection for Connection<Def, Alt>where
Def: DeviceInterface,
Alt: DeviceInterface,
Def::Connection: ConnectionInterface<Device = Def>,
Alt::Connection: ConnectionInterface<Device = Alt>,
impl<Def, Alt> Connection for Connection<Def, Alt>where
Def: DeviceInterface,
Alt: DeviceInterface,
Def::Connection: ConnectionInterface<Device = Def>,
Alt::Connection: ConnectionInterface<Device = Alt>,
§type NativeConnection = NativeConnection<Def, Alt>
type NativeConnection = NativeConnection<Def, Alt>
§type NativeDevice = NativeDevice<Def, Alt>
type NativeDevice = NativeDevice<Def, Alt>
§type NativeWidget = NativeWidget<Def, Alt>
type NativeWidget = NativeWidget<Def, Alt>
source§fn native_connection(&self) -> NativeConnection<Def, Alt>
fn native_connection(&self) -> NativeConnection<Def, Alt>
source§fn gl_api(&self) -> GLApi
fn gl_api(&self) -> GLApi
source§fn create_adapter(&self) -> Result<Adapter<Def, Alt>, Error>
fn create_adapter(&self) -> Result<Adapter<Def, Alt>, Error>
source§fn create_hardware_adapter(&self) -> Result<Adapter<Def, Alt>, Error>
fn create_hardware_adapter(&self) -> Result<Adapter<Def, Alt>, Error>
source§fn create_low_power_adapter(&self) -> Result<Adapter<Def, Alt>, Error>
fn create_low_power_adapter(&self) -> Result<Adapter<Def, Alt>, Error>
source§fn create_software_adapter(&self) -> Result<Adapter<Def, Alt>, Error>
fn create_software_adapter(&self) -> Result<Adapter<Def, Alt>, Error>
source§fn create_device(
&self,
adapter: &Adapter<Def, Alt>,
) -> Result<Device<Def, Alt>, Error>
fn create_device( &self, adapter: &Adapter<Def, Alt>, ) -> Result<Device<Def, Alt>, Error>
source§unsafe fn create_device_from_native_device(
&self,
native_device: NativeDevice<Def, Alt>,
) -> Result<Device<Def, Alt>, Error>
unsafe fn create_device_from_native_device( &self, native_device: NativeDevice<Def, Alt>, ) -> Result<Device<Def, Alt>, Error>
source§fn from_display_handle(
handle: DisplayHandle<'_>,
) -> Result<Connection<Def, Alt>, Error>
fn from_display_handle( handle: DisplayHandle<'_>, ) -> Result<Connection<Def, Alt>, Error>
DisplayHandle
.source§unsafe fn create_native_widget_from_ptr(
&self,
raw: *mut c_void,
size: Size2D<i32>,
) -> NativeWidget<Def, Alt>
unsafe fn create_native_widget_from_ptr( &self, raw: *mut c_void, size: Size2D<i32>, ) -> NativeWidget<Def, Alt>
source§fn create_native_widget_from_window_handle(
&self,
handle: WindowHandle<'_>,
size: Size2D<i32>,
) -> Result<Self::NativeWidget, Error>
fn create_native_widget_from_window_handle( &self, handle: WindowHandle<'_>, size: Size2D<i32>, ) -> Result<Self::NativeWidget, Error>
WindowHandle
.