Skip to main content

OperationContract

Struct OperationContract 

Source
pub struct OperationContract { /* private fields */ }
Expand description

Stable semantic contract for one operation before backend lowering.

Generated operation registries own these descriptors. The builder-style const methods are public so generated code remains ordinary inspectable Rust rather than a private binary table.

Implementations§

Source§

impl OperationContract

Source

pub const MAX_VALUES: usize = 8

Maximum number of fixed logical inputs or outputs.

Source

pub const MAX_ATTRIBUTES: usize = 16

Maximum number of semantic attributes.

Source

pub const fn new( name: &'static str, hash: u64, input_kinds: &'static [OpValueKind], output_kinds: &'static [OpValueKind], ) -> Self

Construct the fixed-arity portion of an operation contract.

Source

pub const fn variadic_inputs(self, kind: OpValueKind, minimum: usize) -> Self

Declare a homogeneous variadic input tail and its minimum length.

Source

pub const fn variadic_outputs(self, kind: OpValueKind, minimum: usize) -> Self

Declare a homogeneous variadic output tail and its minimum length.

Source

pub const fn aligned_variadic_aliases(self) -> Self

Declare that each variadic output aliases and mutates the variadic input at the same tail position.

Source

pub const fn attributes(self, attributes: &'static [OpAttributeSpec]) -> Self

Declare the ordered non-value input signature.

Source

pub const fn with_differentiation(self, value: OpDifferentiation) -> Self

Declare reverse-differentiation behavior.

Source

pub const fn with_shape_rule(self, value: OpShapeRule) -> Self

Declare the schema’s uniform shape rule.

Source

pub const fn with_dtype_rule(self, value: OpDTypeRule) -> Self

Declare the schema’s uniform dtype rule.

Source

pub const fn with_lowering(self, value: OpLowering) -> Self

Declare the backend-neutral lowering family.

Source

pub const fn with_fusion_class(self, value: OpFusionClass) -> Self

Declare the schema’s fusion taxonomy class.

Source

pub const fn effects(self, value: OpEffect) -> Self

Declare logical read and write effects.

Source

pub const fn mutated_inputs(self, mask: u8) -> Self

Declare the fixed-input mutation bit mask.

Source

pub const fn optional_inputs(self, mask: u8) -> Self

Declare the fixed-input optionality bit mask.

Source

pub const fn alias(self, output: usize, input: u8) -> Self

Declare that one output aliases a fixed input’s storage.

Aliasing does not imply mutation. A pass-through output is a fresh SSA value over the same bytes; an in-place write additionally declares the input in Self::mutated_inputs.

Source

pub const fn with_control_flow(self, value: OpControlFlow) -> Self

Declare semantic control flow.

Source

pub const fn name(self) -> &'static str

Return the stable qualified operation name.

Source

pub const fn hash(self) -> u64

Return the schema-derived semantic contract hash.

Source

pub const fn differentiation(self) -> OpDifferentiation

Return the declared differentiation behavior.

Source

pub const fn shape_rule(self) -> OpShapeRule

Return the uniform shape rule.

Source

pub const fn dtype_rule(self) -> OpDTypeRule

Return the uniform dtype rule.

Source

pub const fn attribute_specs(self) -> &'static [OpAttributeSpec]

Return the ordered non-value attribute signature.

Source

pub const fn lowering(self) -> OpLowering

Return the declared lowering family.

Source

pub const fn fusion_class(self) -> OpFusionClass

Return the schema-declared fusion taxonomy class.

Source

pub const fn control_flow(self) -> OpControlFlow

Return the declared control-flow class.

Trait Implementations§

Source§

impl Clone for OperationContract

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for OperationContract

Source§

impl Debug for OperationContract

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where 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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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.