Glossary coding Term Page

self

Owning method receiver

self #coding#rust
Korean version

Aliases

value receiver

Related Concepts

Core Idea

In Rust methods, self means the method takes ownership of the instance instead of borrowing it.

This differs from &self, which borrows immutably, and &mut self, which borrows mutably. Use self when the method should consume the value, move it elsewhere, or finish by returning a transformed replacement.

Why It Matters Here

Mathbong uses this term when comparing the three Rust method receivers and explaining when ownership transfer is the right choice.

Posts Mentioning This Concept