filmov
tv
Rust Generics in a Function
Показать описание
#rust #generic #traits #lifetime #shorts
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.
Generic Types in Rust
Rust Generics in a Function
Rust: Generics, Traits, Lifetimes
Rust Generic Functions | Rust Generics
Generic Traits, Impls, and Slices in Rustlang
Easy Rust 038: Generics part 1
13. Generics
Rust Generics and Traits: Define Common Struct Behaviors 🦀
Rust Programming function, closure & generics
Rust Generics
Rust 'did you know': non-generic inner functions
Generics - Rust
Impl Trait aka Look ma’, no generics! by Jon Gjengset
Generics in Rust - With Examples
Generics in Rust: Functions, Structs, Enums, and Performance
Rust Intro to Generics, Traits, Lifetimes
Rust Dublin Lightning Talks April 2021 - const generics
Rust Generics - Learn Rust EP.7
Introduction to Rust - Part 7: Generics and Traits
Rust Models #4 - Generics
Rust Generics Type with Trait
Rust: Generics
Rust Data Modelling Without Classes
Rust Powered Polymorphism ⚡️ With Traits
Комментарии