Skip to main content

CelScalar

Trait CelScalar 

Source
pub trait CelScalar: Copy {
    // Required methods
    fn cel_int(self) -> i64;
    fn cel_uint(self) -> u64;
    fn cel_double(self) -> f64;
}
Expand description

Width-converts a proto scalar (or enum wrapper) into CEL’s wide types (i64 / u64 / f64).

Used by codegen-emitted native CEL bodies so a single emitted comparison/arithmetic expression works regardless of the underlying Rust representation (i32, u32, i64, u64, f32, f64, or buffa::EnumValue<E>).

Required Methods§

Source

fn cel_int(self) -> i64

Coerce to CEL’s int wide type. Numeric as-casts; for EnumValue<E> returns i64::from(self.to_i32()).

Source

fn cel_uint(self) -> u64

Coerce to CEL’s uint wide type. Numeric as-casts; for floats the cast truncates toward zero.

Source

fn cel_double(self) -> f64

Coerce to CEL’s double wide type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl CelScalar for f32

Source§

fn cel_int(self) -> i64

Source§

fn cel_uint(self) -> u64

Source§

fn cel_double(self) -> f64

Source§

impl CelScalar for f64

Source§

fn cel_int(self) -> i64

Source§

fn cel_uint(self) -> u64

Source§

fn cel_double(self) -> f64

Source§

impl CelScalar for i32

Source§

fn cel_int(self) -> i64

Source§

fn cel_uint(self) -> u64

Source§

fn cel_double(self) -> f64

Source§

impl CelScalar for i64

Source§

fn cel_int(self) -> i64

Source§

fn cel_uint(self) -> u64

Source§

fn cel_double(self) -> f64

Source§

impl CelScalar for u32

Source§

fn cel_int(self) -> i64

Source§

fn cel_uint(self) -> u64

Source§

fn cel_double(self) -> f64

Source§

impl CelScalar for u64

Source§

fn cel_int(self) -> i64

Source§

fn cel_uint(self) -> u64

Source§

fn cel_double(self) -> f64

Source§

impl<E: Enumeration + Copy> CelScalar for EnumValue<E>

Source§

fn cel_int(self) -> i64

Source§

fn cel_uint(self) -> u64

Source§

fn cel_double(self) -> f64

Implementors§