> 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 TraitDefinition

Module: `std`

A compile-time type which represents a trait definition such as `trait Foo { .. }`.

A `TraitDefinition` is passed as the first argument to a macro attribute on top of a trait:

```rust
#[attr]
trait Foo {}

comptime fn attr(trait_definition: TraitDefinition) {
    println(trait_definition); // outputs "Foo"
}
```

## Implementations

```rust
impl TraitDefinition
```

```rust
pub comptime fn as_trait_constraint(_self: Self) -> TraitConstraint
```

```rust
pub comptime fn location(self) -> Location
```

## Trait implementations

```rust
impl Eq for TraitDefinition
```

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

```rust
impl Hash for TraitDefinition
```

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