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

Module: `std`

A compile-time type which represents a function definition in this source program.

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

```rust
#[attr]
fn foo() {}

comptime fn attr(function: FunctionDefinition) {
    println(function.name()); // prints "quote { foo }"
}
```

## Implementations

```rust
impl FunctionDefinition
```

```rust
pub comptime fn as_typed_expr(self) -> TypedExpr
```

```rust
pub comptime fn body(self) -> Expr
```

```rust
pub comptime fn disable(self, error_message: CtString)
```

```rust
pub comptime fn has_named_attribute<let N: u32>(self, name: str<N>) -> bool
```

```rust
pub comptime fn named_attribute_args<let N: u32>(self, name: str<N>) -> [[Quoted]]
```

```rust
pub comptime fn has_builtin_attribute<let N: u32>(self, name: str<N>) -> bool
```

```rust
pub comptime fn is_unconstrained(self) -> bool
```

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

```rust
pub comptime fn module(self) -> Module
```

```rust
pub comptime fn name(self) -> Quoted
```

```rust
pub comptime fn parameters(self) -> [FunctionParameter]
```

The parameters this function was declared with, in source order.

```rust
pub comptime fn return_type(self) -> Type
```

```rust
pub comptime fn visibility(self) -> ItemVisibility
```

The function's visibility.

## Trait implementations

```rust
impl Eq for FunctionDefinition
```

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

```rust
impl Hash for FunctionDefinition
```

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