Glossary coding Term Page

Trait

A Rust interface-like abstraction that describes shared behavior

trait #rust#abstraction#generic
Korean version

Aliases

behavior interface

Prerequisites

Related Concepts

Core Idea

A trait declares the shared methods a type must provide. It lets different concrete types participate in the same generic logic by focusing on behavior instead of concrete structure.

Why It Matters Here

Mathbong uses traits as the hub for generic functions, impl Trait, and standard abstractions such as Display and Iterator. They are the moment Rust shifts from "what type is this?" to "what behavior does this promise?"

Posts Mentioning This Concept