pub type Connection = Connection<Device<Device, Device>, Device>;
Expand description
Either a Wayland or an X11 display server connection.
Aliased Type§
enum Connection {
Default(Connection<Device, Device>),
Alternate(Connection),
}
Variants§
Default(Connection<Device, Device>)
The default connection to the display server.
Alternate(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>,
Source§type NativeConnection = NativeConnection<Def, Alt>
type NativeConnection = NativeConnection<Def, Alt>
Source§type NativeDevice = NativeDevice<Def, Alt>
type NativeDevice = NativeDevice<Def, Alt>
Source§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
.