aztec-nr - std

Primitive type TraitConstraint

A compile-time type which represents a trait constraint that can be used to search for a trait implementation.

This is similar syntactically to just the trait itself, but can also contain generic arguments. E.g. Eq, Default, BuildHasher<Poseidon2Hasher>.

A TraitConstraint can be obtained using Quoted::as_trait_constraint:

fn main() {
    comptime {
        let constraint = quote { Eq }.as_trait_constraint();
        println(constraint); // outputs "Eq"
    }
}

Trait implementations

impl Eq for TraitConstraint

pub comptime fn eq(self, other: Self) -> bool

impl Hash for TraitConstraint

pub comptime fn hash<H>(self, state: &mut H)
where H: Hasher