logo
pub struct Surface<W> { /* private fields */ }
Expand description

Represents a surface on the screen.

Creating a Surface is platform-specific.

Implementations

Creates a Surface from a raw handle.

Safety
  • handle must be a valid Vulkan object handle created from instance.
  • handle must have been created from api.
  • The window object that handle was created from must outlive the created Surface. The win parameter can be used to ensure this.

Creates a Surface with no backing window or display.

Presenting to a headless surface does nothing, so this is mostly useless in itself. However, it may be useful for testing, and it is available for future extensions to layer on top of.

Creates a Surface from a DisplayPlane.

Panic
  • Panics if display_mode and plane don’t belong to the same physical device.
  • Panics if plane doesn’t support the display of display_mode.

Creates a Surface from an Android window.

Safety
  • window must be a valid Android ANativeWindow handle.
  • The object referred to by window must outlive the created Surface. The win parameter can be used to ensure this.

Creates a Surface from a DirectFB surface.

Safety
  • dfb must be a valid DirectFB IDirectFB handle.
  • surface must be a valid DirectFB IDirectFBSurface handle.
  • The object referred to by dfb and surface must outlive the created Surface. The win parameter can be used to ensure this.

Creates a Surface from an Fuchsia ImagePipe.

Safety
  • image_pipe_handle must be a valid Fuchsia zx_handle_t handle.
  • The object referred to by image_pipe_handle must outlive the created Surface. The win parameter can be used to ensure this.

Creates a Surface from a Google Games Platform stream descriptor.

Safety
  • stream_descriptor must be a valid Google Games Platform GgpStreamDescriptor handle.
  • The object referred to by stream_descriptor must outlive the created Surface. The win parameter can be used to ensure this.

Creates a Surface from a Metal CAMetalLayer.

Safety
  • layer must be a valid Metal CAMetalLayer handle.
  • The object referred to by layer must outlive the created Surface. The win parameter can be used to ensure this.

Creates a Surface from a QNX Screen window.

Safety
  • context must be a valid QNX Screen _screen_context handle.
  • window must be a valid QNX Screen _screen_window handle.
  • The object referred to by window must outlive the created Surface. The win parameter can be used to ensure this.

Creates a Surface from a code:nn::code:vi::code:Layer.

Safety
  • window must be a valid nn::vi::NativeWindowHandle handle.
  • The object referred to by window must outlive the created Surface. The win parameter can be used to ensure this.

Creates a Surface from a Wayland window.

The window’s dimensions will be set to the size of the swapchain.

Safety
  • display must be a valid Wayland wl_display handle.
  • surface must be a valid Wayland wl_surface handle.
  • The objects referred to by display and surface must outlive the created Surface. The win parameter can be used to ensure this.

Creates a Surface from a Win32 window.

The surface’s min, max and current extent will always match the window’s dimensions.

Safety
  • hinstance must be a valid Win32 HINSTANCE handle.
  • hwnd must be a valid Win32 HWND handle.
  • The objects referred to by hwnd and hinstance must outlive the created Surface. The win parameter can be used to ensure this.

Creates a Surface from an XCB window.

The surface’s min, max and current extent will always match the window’s dimensions.

Safety
  • connection must be a valid X11 xcb_connection_t handle.
  • window must be a valid X11 xcb_window_t handle.
  • The objects referred to by connection and window must outlive the created Surface. The win parameter can be used to ensure this.

Creates a Surface from an Xlib window.

The surface’s min, max and current extent will always match the window’s dimensions.

Safety
  • display must be a valid Xlib Display handle.
  • window must be a valid Xlib Window handle.
  • The objects referred to by display and window must outlive the created Surface. The win parameter can be used to ensure this.

Returns the instance this surface was created with.

Returns the windowing API that was used to construct the surface.

Returns a reference to the W type parameter that was passed when creating the surface.

Trait Implementations

Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
The type of the object.
Returns a reference to the object.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.