pub struct Connection {
pub(crate) native_connection: Arc<NativeConnectionWrapper>,
}
Expand description
A no-op connection.
Fields§
§native_connection: Arc<NativeConnectionWrapper>
Implementations§
Source§impl Connection
impl Connection
Sourcepub fn new() -> Result<Connection, Error>
pub fn new() -> Result<Connection, Error>
Opens a surfaceless Mesa display.
Sourcepub unsafe fn from_native_connection(
native_connection: NativeConnection,
) -> Result<Connection, Error>
pub unsafe fn from_native_connection( native_connection: NativeConnection, ) -> Result<Connection, Error>
An alias for Connection::new()
, present for consistency with other backends.
Sourcepub fn native_connection(&self) -> NativeConnection
pub fn native_connection(&self) -> NativeConnection
Returns the underlying native 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, Error>
pub fn create_adapter(&self) -> Result<Adapter, Error>
Returns the “best” adapter on this system, preferring high-performance hardware adapters.
This is an alias for Connection::create_hardware_adapter()
.
Sourcepub fn create_hardware_adapter(&self) -> Result<Adapter, Error>
pub fn create_hardware_adapter(&self) -> Result<Adapter, Error>
Returns the “best” adapter on this system, preferring high-performance hardware adapters.
On the OSMesa backend, this returns a software adapter.
Sourcepub fn create_low_power_adapter(&self) -> Result<Adapter, Error>
pub fn create_low_power_adapter(&self) -> Result<Adapter, Error>
Returns the “best” adapter on this system, preferring low-power hardware adapters.
On the OSMesa backend, this returns a software adapter.
Sourcepub fn create_software_adapter(&self) -> Result<Adapter, Error>
pub fn create_software_adapter(&self) -> Result<Adapter, Error>
Returns the “best” adapter on this system, preferring software adapters.
Sourcepub fn create_device(&self, adapter: &Adapter) -> Result<Device, Error>
pub fn create_device(&self, adapter: &Adapter) -> Result<Device, 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,
_: NativeDevice,
) -> Result<Device, Error>
pub unsafe fn create_device_from_native_device( &self, _: NativeDevice, ) -> Result<Device, Error>
An alias for connection.create_device()
with the default adapter.
Sourcepub fn from_display_handle(_: DisplayHandle<'_>) -> Result<Connection, Error>
pub fn from_display_handle(_: DisplayHandle<'_>) -> Result<Connection, 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
pub unsafe fn create_native_widget_from_ptr( &self, _raw: *mut c_void, _size: Size2D<i32>, ) -> NativeWidget
Create a native widget from a raw pointer
Sourcepub fn create_native_widget_from_window_handle(
&self,
_: WindowHandle<'_>,
_size: Size2D<i32>,
) -> Result<NativeWidget, Error>
pub fn create_native_widget_from_window_handle( &self, _: WindowHandle<'_>, _size: Size2D<i32>, ) -> Result<NativeWidget, Error>
Create a native widget type from the given WindowHandle
.
Trait Implementations§
Source§impl Clone for Connection
impl Clone for Connection
Source§fn clone(&self) -> Connection
fn clone(&self) -> Connection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Connection for Connection
impl Connection for Connection
Source§type NativeConnection = NativeConnection
type NativeConnection = NativeConnection
Source§type NativeDevice = NativeDevice
type NativeDevice = NativeDevice
Source§type NativeWidget = NativeWidget
type NativeWidget = NativeWidget
Source§fn native_connection(&self) -> Self::NativeConnection
fn native_connection(&self) -> Self::NativeConnection
Source§fn gl_api(&self) -> GLApi
fn gl_api(&self) -> GLApi
Source§fn create_adapter(&self) -> Result<Self::Adapter, Error>
fn create_adapter(&self) -> Result<Self::Adapter, Error>
Source§fn create_hardware_adapter(&self) -> Result<Self::Adapter, Error>
fn create_hardware_adapter(&self) -> Result<Self::Adapter, Error>
Source§fn create_low_power_adapter(&self) -> Result<Self::Adapter, Error>
fn create_low_power_adapter(&self) -> Result<Self::Adapter, Error>
Source§fn create_software_adapter(&self) -> Result<Self::Adapter, Error>
fn create_software_adapter(&self) -> Result<Self::Adapter, Error>
Source§unsafe fn create_device_from_native_device(
&self,
native_device: Self::NativeDevice,
) -> Result<Device, Error>
unsafe fn create_device_from_native_device( &self, native_device: Self::NativeDevice, ) -> Result<Device, Error>
Source§fn from_display_handle(handle: DisplayHandle<'_>) -> Result<Connection, Error>
fn from_display_handle(handle: DisplayHandle<'_>) -> Result<Connection, Error>
DisplayHandle
.Source§unsafe 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
Source§fn 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>
WindowHandle
.