Struct surfman::platform::unix::generic::connection::Connection
source · 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
.Auto Trait Implementations§
impl Freeze for Connection
impl RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnwindSafe for Connection
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)