PLAY PODCASTS
e002: Something borrowed, something… moved?

e002: Something borrowed, something… moved?

Borrow a `struct` for a while. Then give it back, or keep it for yourself!

New Rustacean

October 12, 201517m 12s

Audio is streamed directly from the publisher (podtrac.com) as published in their RSS feed. Play Podcasts does not host this file. Rights-holders can request removal through the copyright & takedown page.

Show Notes

Something borrowed, something… moved?

Subject: The struct data type constructor, and the basics of Rust’s “ownership” concept and “borrowing” and “moving”.

Follow/Support

Notes

Today’s episode discusses, and the associated source code demonstrates, a few basic behaviors of structs… including borrowing!

After taking a short look at one of Rust’s basic approaches to creating new types, we dive into a fairly thorough overview of how borrowing works in fairly run-of-the-mill Rust code. This is a basic introduction, and as such I’m not getting into things like heap-allocated memory (Box) or dealing with move semantics with threads or closures. (I haven’t actually figured those out well enough yet to write something like this for them!)

As usual, you’ll want to have the src open to see what I’m doing with the components documented below.

Links