Skip to main content

ConstSource

Trait ConstSource 

Source
pub trait ConstSource: Sized + 'static {
    const SLOT: SlotType;

    // Required method
    fn extract(arg: &ConstArg) -> Self;
}
Expand description

ConstArg → typed-Rust-value bridge for owned types in Const<T> position.

Borrow shapes (Const<&str>) are handled by the macro at codegen — it stores String via ConstSource for String and emits Const(self.field.as_str()) at the eval call site to satisfy the operator-side Const<&str> signature.

Required Associated Constants§

Source

const SLOT: SlotType

The slot type the constant occupies.

Required Methods§

Source

fn extract(arg: &ConstArg) -> Self

The value from a build-time constant argument.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ConstSource for String

Source§

const SLOT: SlotType = SlotType::ConstStr

Source§

fn extract(arg: &ConstArg) -> Self

Source§

impl ConstSource for bool

Source§

const SLOT: SlotType = SlotType::ConstU64

Source§

fn extract(arg: &ConstArg) -> Self

Source§

impl ConstSource for f64

Source§

const SLOT: SlotType = SlotType::ConstF64

Source§

fn extract(arg: &ConstArg) -> Self

Source§

impl ConstSource for u64

Source§

const SLOT: SlotType = SlotType::ConstU64

Source§

fn extract(arg: &ConstArg) -> Self

Source§

impl<C: ConstSource> ConstSource for Vec<C>

SRD-80b Phase C — workload-list const combinator. Used by the macro when it sees Const<Vec<C>> in an operator’s signature (e.g. Const<Vec<u64>>, Const<Vec<String>>). The macro emits one Slot::Const { name, slot_type: ConstVec, .. } for the position and packages the trailing consts[..] slice into a ConstArg::List at build time; this impl walks the list, dispatching C::extract per element.

Source§

const SLOT: SlotType = SlotType::ConstVec

Source§

fn extract(arg: &ConstArg) -> Self

Implementors§