---
source: https://iinventedlight.com/library/notes/rust-method-syntax.md
title: "Rust method syntax: define methods in impl blocks with a self receiver"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT OR Apache-2.0 (The Rust Project Developers); MIT OR Apache-2.0 (The Rust Project Developers); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: The Rust Project Developers, Methods - The Rust Programming Language; The Rust Project Developers, Methods (source). MIT OR Apache-2.0 (https://raw.githubusercontent.com/rust-lang/book/main/LICENSE-MIT). Copyright the Rust Project Developers."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-26
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-26
as_of: 2026-11-26
confidence: medium
untested: "Not reproduced (2026-11-26). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: rust-method-syntax"
tags: [rust, methods, impl, self, structs]
client: Librarian
sources:
  - id: S1
    title: "Methods - The Rust Programming Language"
    publisher: The Rust Project Developers
    url: https://doc.rust-lang.org/book/ch05-03-method-syntax.html
    accessed: 2026-11-26
    license: "MIT OR Apache-2.0"
  - id: S2
    title: "Methods (source)"
    publisher: The Rust Project Developers
    url: https://raw.githubusercontent.com/rust-lang/book/main/src/ch05-03-method-syntax.md
    accessed: 2026-11-26
    license: "MIT OR Apache-2.0"
---
# Rust method syntax: define methods in impl blocks with a self receiver
**Answer:** Rust methods are functions defined in an impl block for a type such as a struct, and you call them with dot syntax on an instance.

## impl blocks and the self receiver

Methods look like functions: you declare them with fn, they have a name, they can take parameters and return a value, and their body runs when the method is called.

Unlike free functions, they are defined in the context of a struct, or of an enum or trait object.

Everything inside the impl block is associated with that type, such as Rectangle.

You call a method on an instance with a dot, the method name, and parentheses.

In the signature, &self stands in for rectangle: &Rectangle, and &self is short for self: &Self.

Inside an impl block, Self aliases the implemented type. The first parameter must be named self and have type Self, so Rust lets you write just self. A method may own self or borrow it, using &mut self to change the instance.

## Getters and automatic dereferencing

A method may share a name with a struct field: parentheses call the method, and their absence reads the field.

Same-named methods that only return the field are often called getters, and Rust does not generate them automatically.

Rust has no -> operator; it relies on automatic referencing and dereferencing, and method calls are one of few such places.

## See also

- [rust-structs](https://iinventedlight.com/library/notes/rust-structs/)
- [rust-traits](https://iinventedlight.com/library/notes/rust-traits/)
- [rust-impl-trait](https://iinventedlight.com/library/notes/rust-impl-trait/)

## Claims

- id: C1
  claim: Methods belong to the type named by the impl block.
  source: S1
  evidence: "Everything within this impl block will be associated with the Rectangle type."

- id: C2
  claim: &self is shorthand for a Self receiver borrowed immutably.
  source: S2
  evidence: "The `&self` is actually short for `self: &Self`."

- id: C3
  claim: Parentheses distinguish a same-named method from the field.
  source: S1
  evidence: "When we don't use parentheses, Rust knows we mean the field width ."

## Sources

- [S1] Methods - The Rust Programming Language. The Rust Project Developers. https://doc.rust-lang.org/book/ch05-03-method-syntax.html . License: MIT OR Apache-2.0. Accessed 2026-11-26.

- [S2] Methods (source). The Rust Project Developers. https://raw.githubusercontent.com/rust-lang/book/main/src/ch05-03-method-syntax.md . License: MIT OR Apache-2.0. Accessed 2026-11-26.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Rust Project Developers, Methods - The Rust Programming Language; The Rust Project Developers, Methods (source). MIT OR Apache-2.0 (https://raw.githubusercontent.com/rust-lang/book/main/LICENSE-MIT). Copyright the Rust Project Developers. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
