pub struct Connection {
    pub(crate) native_connection: Arc<NativeConnectionWrapper>,
}
Expand description

A no-op connection.

Fields§

§native_connection: Arc<NativeConnectionWrapper>

Implementations§

source§

impl Connection

source

pub fn new() -> Result<Connection, Error>

Opens a surfaceless Mesa display.

source

pub unsafe fn from_native_connection( native_connection: NativeConnection ) -> Result<Connection, Error>

An alias for Connection::new(), present for consistency with other backends.

source

pub fn native_connection(&self) -> NativeConnection

Returns the underlying native connection.

source

pub fn gl_api(&self) -> GLApi

Returns the OpenGL API flavor that this connection supports (OpenGL or OpenGL ES).

source

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().

source

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.

source

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.

source

pub fn create_software_adapter(&self) -> Result<Adapter, Error>

Returns the “best” adapter on this system, preferring software adapters.

source

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.

source

pub unsafe fn create_device_from_native_device( &self, _: NativeDevice ) -> Result<Device, Error>

An alias for connection.create_device() with the default adapter.

source

pub fn from_raw_display_handle(_: RawDisplayHandle) -> Result<Connection, Error>

Opens the display connection corresponding to the given raw display handle.

source

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

source

pub fn create_native_widget_from_raw_window_handle( &self, _: RawWindowHandle, _size: Size2D<i32> ) -> Result<NativeWidget, Error>

Create a native widget type from the given raw_window_handle::RawWindowHandle.

Trait Implementations§

source§

impl Clone for Connection

source§

fn clone(&self) -> Connection

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Connection for Connection

§

type Adapter = Adapter

The adapter type associated with this connection.
§

type Device = Device

The device type associated with this connection.
§

type NativeConnection = NativeConnection

The native type associated with this connection.
§

type NativeDevice = NativeDevice

The native device type associated with this connection.
§

type NativeWidget = NativeWidget

The native widget type associated with this connection.
source§

fn new() -> Result<Connection, Error>

Connects to the default display.
source§

fn native_connection(&self) -> Self::NativeConnection

Returns the native connection corresponding to this connection.
source§

fn gl_api(&self) -> GLApi

Returns the OpenGL API flavor that this connection supports (OpenGL or OpenGL ES).
source§

fn create_adapter(&self) -> Result<Adapter, Error>

Returns the “best” adapter on this system, preferring high-performance hardware adapters. Read more
source§

fn create_hardware_adapter(&self) -> Result<Adapter, Error>

Returns the “best” adapter on this system, preferring high-performance hardware adapters.
source§

fn create_low_power_adapter(&self) -> Result<Adapter, Error>

Returns the “best” adapter on this system, preferring low-power hardware adapters.
source§

fn create_software_adapter(&self) -> Result<Adapter, Error>

Returns the “best” adapter on this system, preferring software adapters.
source§

fn create_device(&self, adapter: &Adapter) -> Result<Device, Error>

Opens a device.
source§

unsafe fn create_device_from_native_device( &self, native_device: Self::NativeDevice ) -> Result<Device, Error>

Wraps an existing native device type in a device.
source§

fn from_raw_display_handle( raw_handle: RawDisplayHandle ) -> Result<Connection, Error>

Opens the display connection corresponding to the given raw display handle.
source§

unsafe fn create_native_widget_from_ptr( &self, raw: *mut c_void, size: Size2D<i32> ) -> NativeWidget

Creates a native widget from a raw pointer
source§

fn create_native_widget_from_raw_window_handle( &self, window: RawWindowHandle, size: Size2D<i32> ) -> Result<NativeWidget, Error>

Create a native widget type from the given raw_window_handle::RawWindowHandle.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.