Menu
Sign In Search Podcasts Libraries Charts People & Topics Add Podcast API Blog Pricing

Alice Ryhl

๐Ÿ‘ค Speaker
505 total appearances

Appearances Over Time

Podcast Appearances

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

The other classic example would be to call into a C library.

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

You can write a library that calls into C and you can even have a safe API.

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

And then you can enforce that you only call the C API in the right way.

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

So crate is just the Rust word for a package.

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

So it's just a package of your code.

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

So the way it works is that Rust has a tool called cargo.

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

And cargo is kind of, it does a lot of stuff.

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

It's actually a pretty neat tool that's kind of all in one.

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

So it will do, it's both what you use to run your code.

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

You do cargo run and it will compile your code.

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

You have this thing called cargo tumble where you specify your dependencies and other information about your crate.

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

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

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

Cargo test will also run your doc tests.

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

There's even benchmarks and examples.

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

So it does all the whole suite, so to say.

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

So you don't need different tools to fetch dependencies and run your code and generate docs.

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

I think the biggest difference from something like PIP would be that they're not installed to your machine, right?

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

Yeah.

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

With Pip, you either install things globally or you have these virtual environments.

The Pragmatic Engineer
Why Rust is different, with Alice Ryhl

So with Cargo, it's all local.