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>,

source

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

Connects to the default display.

source

pub fn native_connection(&self) -> NativeConnection<Def, Alt>

Returns the native connection corresponding to this 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<Def, Alt>, Error>

Returns the “best” adapter on this system.

This is an alias for Connection::create_hardware_adapter().

source

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

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

source

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

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

source

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

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

source

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.

source

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.

source

pub fn from_raw_display_handle( raw_handle: RawDisplayHandle ) -> Result<Connection<Def, Alt>, 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<Def, Alt>

Create a native widget from a raw pointer

source

pub fn create_native_widget_from_raw_window_handle( &self, raw_handle: RawWindowHandle, size: Size2D<i32> ) -> Result<NativeWidget<Def, Alt>, Error>

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

Trait Implementations§

source§

impl<Def, Alt> Clone for Connection<Def, Alt>where Def: DeviceInterface, Alt: DeviceInterface, Def::Connection: Clone, Alt::Connection: Clone,

source§

fn clone(&self) -> Self

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<Def, Alt> Connection for Connection<Def, Alt>where Def: DeviceInterface, Alt: DeviceInterface, Def::Connection: ConnectionInterface<Device = Def>, Alt::Connection: ConnectionInterface<Device = Alt>,

§

type Adapter = Adapter<Def, Alt>

The adapter type associated with this connection.
§

type Device = Device<Def, Alt>

The device type associated with this connection.
§

type NativeConnection = NativeConnection<Def, Alt>

The native type associated with this connection.
§

type NativeDevice = NativeDevice<Def, Alt>

The native device type associated with this connection.
§

type NativeWidget = NativeWidget<Def, Alt>

The native widget type associated with this connection.
source§

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

Connects to the default display.
source§

fn native_connection(&self) -> NativeConnection<Def, Alt>

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<Def, Alt>, Error>

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

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

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

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

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

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

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

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

Opens a device.
source§

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

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

fn from_raw_display_handle( raw_handle: RawDisplayHandle ) -> Result<Connection<Def, Alt>, 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<Def, Alt>

Creates a native widget from a raw pointer
source§

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

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

Auto Trait Implementations§

§

impl<Def, Alt> RefUnwindSafe for Connection<Def, Alt>where <Alt as Device>::Connection: RefUnwindSafe, <Def as Device>::Connection: RefUnwindSafe,

§

impl<Def, Alt> Send for Connection<Def, Alt>where <Alt as Device>::Connection: Send, <Def as Device>::Connection: Send,

§

impl<Def, Alt> Sync for Connection<Def, Alt>where <Alt as Device>::Connection: Sync, <Def as Device>::Connection: Sync,

§

impl<Def, Alt> Unpin for Connection<Def, Alt>where <Alt as Device>::Connection: Unpin, <Def as Device>::Connection: Unpin,

§

impl<Def, Alt> UnwindSafe for Connection<Def, Alt>where <Alt as Device>::Connection: UnwindSafe, <Def as Device>::Connection: UnwindSafe,

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.