Trait naga::proc::constant_evaluator::TryFromAbstract

source ·
trait TryFromAbstract<T>: Sized {
    // Required method
    fn try_from_abstract(value: T) -> Result<Self, ConstantEvaluatorError>;
}
Expand description

Trait for conversions of abstract values to concrete types.

Required Methods§

source

fn try_from_abstract(value: T) -> Result<Self, ConstantEvaluatorError>

Convert an abstract literal value to Self.

Since Naga’s AbstractInt and AbstractFloat exist to support WGSL, we follow WGSL’s conversion rules here:

  • WGSL §6.1.2. Conversion Rank says that automatic conversions to integers are either lossless or an error.

  • WGSL §14.6.4 Floating Point Conversion says that conversions to floating point in constant expressions and override expressions are errors if the value is out of range for the destination type, but rounding is okay.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl TryFromAbstract<f64> for f32

source§

impl TryFromAbstract<f64> for f64

source§

impl TryFromAbstract<f64> for i32

source§

impl TryFromAbstract<f64> for i64

source§

impl TryFromAbstract<f64> for u32

source§

impl TryFromAbstract<f64> for u64

source§

impl TryFromAbstract<i64> for f32

source§

impl TryFromAbstract<i64> for f64

source§

impl TryFromAbstract<i64> for i32

source§

impl TryFromAbstract<i64> for i64

source§

impl TryFromAbstract<i64> for u32

source§

impl TryFromAbstract<i64> for u64

Implementors§