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 25,600 courses taught by industry experts.

Demo: Using Cargo for dependencies

Demo: Using Cargo for dependencies

- [Instructor] We've made a lot of progress in our library, our Rust library. We've added a function here, which is the read_stdin(), and now it's time, like it's very well organized. We have the basic, we have the Makefile. We don't have dependencies yet, but now that we have this here, what I want is to actually use what we've created right there, like the read_stdin(). Remember we extracted that function away from another package that I had. So how does this work? Well, we're going to go back to this other project and then pull this in. Now I know what the path is for this library, this cli-utils, so let's go ahead and see how we can do that. So this is the resplit project. Remember, if I go to lib.rs, the read_stdin() used to be here. So I'm going to instead of like call it right there, this is read_stdin() and that is, let's check where that's getting used. It's not getting used here. It's actually, let's see in main.rs. So in main.rs, you can see it comes right there. So instead…

Contents