Alice Ryhl
๐ค SpeakerAppearances Over Time
Podcast Appearances
The other classic example would be to call into a C library.
You can write a library that calls into C and you can even have a safe API.
And then you can enforce that you only call the C API in the right way.
So crate is just the Rust word for a package.
So it's just a package of your code.
So the way it works is that Rust has a tool called cargo.
And cargo is kind of, it does a lot of stuff.
It's actually a pretty neat tool that's kind of all in one.
So it will do, it's both what you use to run your code.
You do cargo run and it will compile your code.
You have this thing called cargo tumble where you specify your dependencies and other information about your crate.
and when you do cargo run it will download the dependencies to something called a registry which is basically just a directory with all the crates you've ever downloaded yeah and you can also do cargo test it will run all your tests cargo dock it will generate your dock
Cargo test will also run your doc tests.
There's even benchmarks and examples.
So it does all the whole suite, so to say.
So you don't need different tools to fetch dependencies and run your code and generate docs.
I think the biggest difference from something like PIP would be that they're not installed to your machine, right?
With Pip, you either install things globally or you have these virtual environments.
So with Cargo, it's all local.