> Aztec.nr API reference, v6.0.0 (mainnet and testnet). Index: https://docs.aztec.network/aztec-nr-api/v6.0.0/llms.txt

# Primitive type TraitConstraint

Module: `std`

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`](/aztec-nr-api/v6.0.0/std/primitive.Quoted.md#as_trait_constraint):

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

## Trait implementations

```rust
impl Eq for TraitConstraint
```

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

```rust
impl Hash for TraitConstraint
```

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