File:Crust of Rust- Lifetime Annotations.webm

Summary

Description
English: In the 2019 Rust Survey, a lot of people were asking for video content covering intermediate Rust content. So in this first video (possibly of many), we're going to investigate a case where you need multiple explicit lifetime annotations. We explore why they are needed, and why we need more than one in this particular case. We also talk about some of the differences between the string types and introduce generics over a self-defined trait in the process.

And don't worry, I know that what we're implementing exists in the standard library :)

0:00:00 Introduction 0:03:36 Start a rust project 0:05:20 Struct and method definitions for StrSplit and first test 0:09:32 How you decide between a library and a binary 0:10:58 Start implementing StrSplit 0:16:15 When to use match vs if let some 0:17:10 Doesn't compile! missing lifetime specifier 0:20:33 Can I be wrong by specifying lifetimes? 0:21:25 Anonymous lifetime '_ 0:23:10 Order lifetimes based on how long they are 0:25:18 Anonymous lifetime '_ (with multiple lifetimes) 0:26:52 Compile error: lifetime of reference outlives lifetime of borrowed content 0:34:45 Static lifetime 0:41:27 Bug when a delimiter tails a string 0:48:07 What is the ref keyword and why not & 0:51:36 What's the * on the left of remainder 0:52:46 What is take() doing 0:54:48 Mutable references are one level deep 0:55:39 Solving a hang with as_mut() 0:57:49 Multiple lifetimes, implementing until_char 1:03:19 Difference between a str and a String 1:08:15 Multiple lifetimes (continued) 1:15:24 Generic delimiter (Delimiter trait) 1:23:14 char length utf8 1:25:30 Standard library split 1:27:39 Q&A

You can find the final code at https://gist.github.com/jonhoo/2a7fdcf79be03e51a5f95cd326f2a1e8.

You can watch the live version with comments at https://www.youtube.com/watch?v=Oxaex566Irg
Date
Source YouTube: Crust of Rust: Lifetime Annotations – View/save archived versions on archive.org and archive.todayCategory:Media from YouTube
Author Jon Gjengset

Licensing

This video, screenshot or audio excerpt was originally uploaded on YouTube under a CC BY license.
Their website states: "YouTube allows users to mark their videos with a Creative Commons CC BY license."
To the uploader: You must provide a link (URL) to the original file and the authorship information if available.
w:en:Creative Commons
attribution
This file is licensed under the Creative Commons Attribution 3.0 Unported license.
Attribution:
Jon Gjengset
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
Category:CC-BY-3.0#Crust%20of%20Rust-%20Lifetime%20Annotations.webm
Category:Media from YouTube#Crust%20of%20Rust-%20Lifetime%20Annotations.webm
This file, which was originally posted to an external website, has not yet been reviewed by an administrator or reviewer to confirm that the above license is valid. See Category:License review needed for further instructions.
Category:License review needed (video)#153341796 Category:Uploaded with video2commons Category:Videos of Rust (programming language)
Category:CC-BY-3.0 Category:License review needed (video) Category:Media from YouTube Category:Uploaded with video2commons Category:Videos of Rust (programming language)