From the course: Rust Programming: From Fundamentals to Advanced Concepts with AI-Assisted Development

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Demo: Adding code to lib

Demo: Adding code to lib

- [Instructor] Next, we are going to go ahead and look back again to our re-split project here, and we're going to select, we're going to copy paste this read standard in, and move it over to our library, our lib dot RS, in our other CLIU utils project. So that's here, I'm going to paste it in, and we should like almost right out of the bat, get certain problems, specifically Buff Reader needs to be imported in. So to satisfy that, I'm going to use some imports here with use, and I'm going to say I want both Buff Reader and Buff Read. Actually, if I do just that, I'll get an error. Why don't we explore for a second here, what is the error if I only use Buff Reader? So let's hover over the red line, and we're going to get "no method named read line found for struct BufReader in the current scope. Items from traits can only be used if the trait is in scope." What does that mean? That means that in some situations in rust, you have to make some imports, you have to pull certain modules…

Contents