pub enum GpuPowerPreference {
LowPower,
HighPerformance,
}Expand description
The power preference hint passed to navigator.gpu.requestAdapter.
Maps to the WebGPU GPUPowerPreference enum. The browser uses this
hint to select a GPU adapter when multiple are available.
Variants§
LowPower
Prefers a low-power adapter to conserve energy, suitable for mobile devices and battery-conscious scenarios.
HighPerformance
Prefers a high-performance adapter for maximum rendering throughput, suitable for desktop gaming and compute-intensive scenes.
Implementations§
Source§impl GpuPowerPreference
Implements WebGPU power preference conversion for GpuPowerPreference.
impl GpuPowerPreference
Implements WebGPU power preference conversion for GpuPowerPreference.
Sourcepub fn to_web_sys_string(&self) -> &'static str
pub fn to_web_sys_string(&self) -> &'static str
Converts this power preference to the WebGPU string value.
Used to set the powerPreference field on GpuRequestAdapterOptions
via Reflect::set, avoiding a direct dependency on the
web_sys::GpuPowerPreference type.
§Returns
&'static str- The WebGPU power preference string (e.g.,"low-power").
Trait Implementations§
Source§impl Clone for GpuPowerPreference
impl Clone for GpuPowerPreference
Source§fn clone(&self) -> GpuPowerPreference
fn clone(&self) -> GpuPowerPreference
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for GpuPowerPreference
Source§impl Debug for GpuPowerPreference
impl Debug for GpuPowerPreference
Source§impl Default for GpuPowerPreference
impl Default for GpuPowerPreference
Source§fn default() -> GpuPowerPreference
fn default() -> GpuPowerPreference
Returns the “default value” for a type. Read more
impl Eq for GpuPowerPreference
Source§impl Hash for GpuPowerPreference
impl Hash for GpuPowerPreference
Source§impl PartialEq for GpuPowerPreference
impl PartialEq for GpuPowerPreference
impl StructuralPartialEq for GpuPowerPreference
Auto Trait Implementations§
impl Freeze for GpuPowerPreference
impl RefUnwindSafe for GpuPowerPreference
impl Send for GpuPowerPreference
impl Sync for GpuPowerPreference
impl Unpin for GpuPowerPreference
impl UnsafeUnpin for GpuPowerPreference
impl UnwindSafe for GpuPowerPreference
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