filmov
tv
Rust: Generics, Traits, Lifetimes
Показать описание
#rust #generic #traits #lifetime
Generics are like a placeholder to another type. Think of a can with food in it. That can is concrete but the food inside is a generic type. The can have soup, beans, corn, or almost anything else inside it.
We have already been using generics with the `Option` type and `Result` type from the error handling chapter.
Here, we will discover how to use generics with our own functions, structs, and methods.
Traits are used to define behavior in a generic way.
And, finally, you cannot talk about generics without talking about lifetimes. This is Rust feature has probably popped up for you in compiler error messages.
Links
Chapter 17 of the Rust Programming book as it relates to the discussion.
Generics are like a placeholder to another type. Think of a can with food in it. That can is concrete but the food inside is a generic type. The can have soup, beans, corn, or almost anything else inside it.
We have already been using generics with the `Option` type and `Result` type from the error handling chapter.
Here, we will discover how to use generics with our own functions, structs, and methods.
Traits are used to define behavior in a generic way.
And, finally, you cannot talk about generics without talking about lifetimes. This is Rust feature has probably popped up for you in compiler error messages.
Links
Chapter 17 of the Rust Programming book as it relates to the discussion.
Rust: Generics, Traits, Lifetimes
Rust's lifetimes made easy
Rust Lifetimes Finally Explained!
Generic Types in Rust
Generics, Traits, and Lifetimes in Rust: Concepts & Examples -Full Crash Rust Tutorial for Begin...
but what is 'a lifetime?
Generic Types, Traits, and Lifetimes: #1: Generic Data Types in Rust
Rust Intro to Generics, Traits, Lifetimes
Rust Powered Polymorphism ⚡️ With Traits
Rust Generics in a Function
Rust Generics and Traits: Define Common Struct Behaviors 🦀
Rust Generics Type with Trait
Rust Demystified 🪄 Simplifying The Toughest Parts
Generic Traits, Impls, and Slices in Rustlang
Impl Trait aka Look ma’, no generics! by Jon Gjengset
Rust Book Club #10: Generics, Traits & Lifetimes
Sub0 Online: Rust: Lifetimes, Traits, and Generics - Maciej Hirsz, Parity Technologies
Rust Lifetimes explained Tutorial
Rust's second most complicated feature explained
Rust Annotation Lifetimes Syntax
Generic Types, Traits, and Lifetimes: #2: Traits: Defining Shared Behavior in Rust (Part 1)
PROG2006: Rust - generics, traits and lifetimes
5 traits your Rust types must implement
Rust Error Handling, Generic Types, Traits and Lifetimes (9-10)
Комментарии