pub enum Surface<Def, Alt>where
    Def: DeviceInterface,
    Alt: DeviceInterface,{
    Default(Def::Surface),
    Alternate(Alt::Surface),
}
Expand description

Represents a hardware buffer of pixels that can be rendered to via the CPU or GPU and either displayed in a native widget or bound to a texture for reading.

Surfaces come in two varieties: generic and widget surfaces. Generic surfaces can be bound to a texture but cannot be displayed in a widget (without using other APIs such as Core Animation, DirectComposition, or XPRESENT). Widget surfaces are the opposite: they can be displayed in a widget but not bound to a texture.

Surfaces are specific to a given context and cannot be rendered to from any context other than the one they were created with. However, they can be read from any context on any thread (as long as that context shares the same adapter and connection), by wrapping them in a SurfaceTexture.

Depending on the platform, each surface may be internally double-buffered.

Surfaces must be destroyed with the destroy_surface() method, or a panic will occur.

Variants§

§

Default(Def::Surface)

The default surface type.

§

Alternate(Alt::Surface)

The alternate surface type.

Trait Implementations§

source§

impl<Def, Alt> Debug for Surface<Def, Alt>where Def: DeviceInterface, Alt: DeviceInterface,

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Def, Alt> RefUnwindSafe for Surface<Def, Alt>where <Alt as Device>::Surface: RefUnwindSafe, <Def as Device>::Surface: RefUnwindSafe,

§

impl<Def, Alt> Send for Surface<Def, Alt>where <Alt as Device>::Surface: Send, <Def as Device>::Surface: Send,

§

impl<Def, Alt> Sync for Surface<Def, Alt>where <Alt as Device>::Surface: Sync, <Def as Device>::Surface: Sync,

§

impl<Def, Alt> Unpin for Surface<Def, Alt>where <Alt as Device>::Surface: Unpin, <Def as Device>::Surface: Unpin,

§

impl<Def, Alt> UnwindSafe for Surface<Def, Alt>where <Alt as Device>::Surface: UnwindSafe, <Def as Device>::Surface: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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, U> TryFrom<U> for Twhere 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 Twhere 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.