flâneur — a map of the web's best reading

Traits: Defining Shared Behavior - The Rust Programming Language

doc.rust-lang.org · 3,442 words · saved by 4 readers

A trait defines functionality a particular type has and can share with other types. We can use traits to define shared behavior in an abstract way. We can use trait bounds to specify that a generic type can be any type that has certain behavior.

Defining Shared Behavior with Traits - The Rust Programming Language Keyboard shortcuts Press ← or → to navigate between chapters Press S or / to search in the book Press ? to show this help Press Esc to hide this help Auto Light Rust Coal Navy Ayu The Rust Programming Language Defining Shared Behavior with Traits A trait defines the functionality a particular type has and can share with other types. We can use traits to define shared behavior in an abstract way. We can use trait bounds to specify that a generic type can be any type that has certain behavior. Note: Traits are similar to a feat

Explore this link on the map →

saved by

related reading