Enum surfman::platform::generic::multi::connection::Connection

source ·
pub enum Connection<Def, Alt>{
    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_display_handle( handle: DisplayHandle<'_>, ) -> Result<Connection<Def, Alt>, Error>

Opens the display connection corresponding to the given DisplayHandle.

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

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

source§

type Adapter = Adapter<Def, Alt>

The adapter type associated with this connection.
source§

type Device = Device<Def, Alt>

The device type associated with this connection.
source§

type NativeConnection = NativeConnection<Def, Alt>

The native type associated with this connection.
source§

type NativeDevice = NativeDevice<Def, Alt>

The native device type associated with this connection.
source§

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_display_handle( handle: DisplayHandle<'_>, ) -> Result<Connection<Def, Alt>, Error>

Opens the display connection corresponding to the given DisplayHandle.
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_window_handle( &self, handle: WindowHandle<'_>, size: Size2D<i32>, ) -> Result<Self::NativeWidget, Error>

Create a native widget type from the given WindowHandle.

Auto Trait Implementations§

§

impl<Def, Alt> Freeze for Connection<Def, Alt>
where <Alt as Device>::Connection: Sized + Freeze, <Def as Device>::Connection: Sized + Freeze,

§

impl<Def, Alt> RefUnwindSafe for Connection<Def, Alt>

§

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

§

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

§

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

§

impl<Def, Alt> UnwindSafe for Connection<Def, Alt>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 T
where 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 T
where T: Clone,

source§

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 T
where U: Into<T>,

source§

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 T
where U: TryFrom<T>,

source§

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.