Struct surfman::platform::unix::wayland::connection::Connection

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

A connection to the Wayland server.

Fields§

§native_connection: Arc<NativeConnectionWrapper>

Implementations§

source§

impl Connection

source

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

Connects to the default Wayland server.

source

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

Wraps an existing EGL display in a Connection.

The display is not retained, as there is no way to do this in the EGL API. Therefore, it is the caller’s responsibility to ensure that the EGL display remains alive as long as the connection is.

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.

source

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

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

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, native_device: NativeDevice, ) -> Result<Device, Error>

Opens the hardware device corresponding to the adapter wrapped in the given native device.

This is present for compatibility with other backends.

source

unsafe fn from_wayland_display( wayland_display: *mut wl_display, is_owned: bool, ) -> Result<Connection, Error>

source

fn from_egl_display( egl_display: *const c_void, wayland_display: Option<*mut wl_display>, ) -> Result<Connection, Error>

source

pub fn from_display_handle( handle: DisplayHandle<'_>, ) -> Result<Connection, 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

Create a native widget from a raw pointer

source

pub fn create_native_widget_from_window_handle( &self, handle: WindowHandle<'_>, window_size: Size2D<i32>, ) -> Result<NativeWidget, Error>

Creates a native widget type from the given WindowHandle

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<Self::Adapter, Error>

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

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

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

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

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

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

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

fn create_device(&self, adapter: &Adapter) -> Result<Self::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_display_handle(handle: DisplayHandle<'_>) -> Result<Connection, 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>, ) -> Self::NativeWidget

Creates a native widget from a raw pointer
source§

fn create_native_widget_from_window_handle( &self, window: WindowHandle<'_>, size: Size2D<i32>, ) -> Result<Self::NativeWidget, Error>

Create a native widget type from the given WindowHandle.
source§

impl Send for Connection

Auto Trait Implementations§

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

§

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

§

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

§

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.