pub struct Instance {
pub name: String,
pub instance_per_backend: Vec<(Backend, Box<dyn DynInstance>)>,
pub flags: InstanceFlags,
}
Fields§
§name: String
§instance_per_backend: Vec<(Backend, Box<dyn DynInstance>)>
List of instances per backend.
The ordering in this list implies prioritization and needs to be preserved.
flags: InstanceFlags
Implementations§
Source§impl Instance
impl Instance
pub fn new(name: &str, instance_desc: InstanceDescriptor) -> Self
pub fn raw(&self, backend: Backend) -> Option<&dyn DynInstance>
Sourcepub unsafe fn as_hal<A: HalApi>(&self) -> Option<&A::Instance>
pub unsafe fn as_hal<A: HalApi>(&self) -> Option<&A::Instance>
§Safety
- The raw instance handle returned must not be manually destroyed.
Sourcepub unsafe fn create_surface(
&self,
display_handle: RawDisplayHandle,
window_handle: RawWindowHandle,
) -> Result<Surface, CreateSurfaceError>
Available on crate feature raw-window-handle
only.
pub unsafe fn create_surface( &self, display_handle: RawDisplayHandle, window_handle: RawWindowHandle, ) -> Result<Surface, CreateSurfaceError>
raw-window-handle
only.Creates a new surface targeting the given display/window handles.
Internally attempts to create hal surfaces for all enabled backends.
Fails only if creation for surfaces for all enabled backends fails in which case the error for each enabled backend is listed. Vice versa, if creation for any backend succeeds, success is returned. Surface creation errors are logged to the debug log in any case.
§Safety
display_handle
must be a valid object to create a surface upon.window_handle
must remain valid as long as the returnedSurfaceId
is being used.
pub fn enumerate_adapters(&self, backends: Backends) -> Vec<Adapter>
pub fn request_adapter( &self, desc: &RequestAdapterOptions<&Surface>, backends: Backends, ) -> Result<Adapter, RequestAdapterError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Instance
impl !RefUnwindSafe for Instance
impl Send for Instance
impl Sync for Instance
impl Unpin for Instance
impl !UnwindSafe for Instance
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
Mutably borrows from an owned value. Read more