Struct wgpu::Instance[][src]

pub struct Instance { /* fields omitted */ }

Context for all other wgpu objects. Instance of wgpu.

This is the first thing you create when using wgpu. Its primary use is to create Adapters and Surfaces.

Does not have to be kept alive.


impl Instance[src]

pub fn new(backends: BackendBit) -> Self[src]

Create an new instance of wgpu.


  • backends - Controls from which backends wgpu will choose during instantiation.

pub fn enumerate_adapters(
    backends: BackendBit
) -> impl Iterator<Item = Adapter>

Retrieves all available Adapters that match the given BackendBit.


  • backends - Backends from which to enumerate adapters.

pub fn request_adapter(
    options: &RequestAdapterOptions<'_>
) -> impl Future<Output = Option<Adapter>> + Send

Retrieves an Adapter which matches the given RequestAdapterOptions.

Some options are “soft”, so treated as non-mandatory. Others are “hard”.

If no adapters are found that suffice all the “hard” options, None is returned.

pub unsafe fn create_surface<W: HasRawWindowHandle>(
    window: &W
) -> Surface

Creates a surface from a raw window handle.


  • Raw Window Handle must be a valid object to create a surface upon.

pub fn poll_all(&self, force_wait: bool)[src]

Polls all devices. If force_wait is true and this is not running on the web, then this function will block until all in-flight buffers have been mapped.

Trait Implementations

impl Debug for Instance[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl !RefUnwindSafe for Instance

impl Send for Instance

impl Sync for Instance

impl Unpin for Instance

impl !UnwindSafe for Instance

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> Downcast<T> for T

pub fn downcast(&self) -> &T

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> Upcast<T> for T

pub fn upcast(&self) -> Option<&T>