Become a sponsor

Contact

]]>Mon, 14 May 2018 20:45:00 -060025BF49BF-C267-4BFA-B36F-D186D0074396`impl trait`, `match` on references, `Result`s from `main`, and more. A good way to mark three years since Rust 1.0!17:27fulle023: Traits Deep Dive, Part Ihttp://newrustacean.com/show_notes/e023/
Defining and using your own traits, using other crates' traits, and the orphan rule.

Become a sponsor

Contact

]]>Sat, 28 Apr 2018 15:33:44 -06008F524C0B-AC10-4997-95D8-F55EC1398544Defining and using your own traits, using other crates' traits, and the orphan rule.Defining and using your own traits, using other crates' traits, and the orphan rule.20:33fullNews: Rust 1.25http://newrustacean.com/show_notes/news/rust_1_25/
Paths and matches and SIMD, cargo new changes, and tons of community-driven learning materials!

Become a sponsor

Contact

]]>Sun, 21 Jan 2018 16:25:23 -0700EF73A61F-960D-4857-9492-E5FFB2D019ABGetting Diesel to 1.0, writing docs and exposing problems with the API, improving Diesel in the future, and thinking about API design for open source libraries in general.Getting Diesel to 1.0, writing docs and exposing problems with the API, improving Diesel in the future, and thinking about API design for open source libraries in general.31:01fullInterview – Diesel 1.0, with Sean Griffin – Part 1http://newrustacean.com/show_notes/interview/diesel_1_0/part_1/
Growing Diesel's community, self-imposed technical challenges, and some of the ways Diesel has contributed to the Rust ecosystem.

Become a sponsor

Contact

]]>Sat, 13 Jan 2018 12:50:00 -0700CC652BFB-A049-45F8-8961-C424DEBBA6E7Growing Diesel's community, self-imposed technical challenges, and some of the ways Diesel has contributed to the Rust ecosystem.Growing Diesel's community, self-imposed technical challenges, and some of the ways Diesel has contributed to the Rust ecosystem.31:57fullNews: Rust 1.23http://newrustacean.com/show_notes/news/rust_1_23/
Show notes

**Chris:** hello! Can you tell me your name and a little bit about yourself?

**Anthony:** My name is Anthony Deschamps, I, um, I’m a software developer, I work in Automotive.

**Chris:** Oh! Very interesting. Long-time listeners will recognize Anthony’s name as a sponsor of the show; thank you for sponsoring the show!

**Anthony:** You’re welcome!

**Chris:** So, what got you into Rust?

**Anthony:** I’ve talked about this earlier; I actually can’t remember how I first came across it. Um, I remember my friends being excited about it and looking at it at some point, um, but what really hooked me is that I have a huge amount of respect for C+ +, uh, it was one of my first languages, and to me, Rust feels like C+ + with decades of learned lessons. If we have a clean slate, and what you can do with a fresh start.

**Chris:** Yeah. How long - do you remember roughly, obviously you don’t remember exactly when, but - do you remember roughly how long...pre 1.0, post 1.0?

**Anthony:** Uh, probably about a year ago, so, somewhere after 1.10 or roundabouts.

**Chris:** Okay. Very good. What has your experience of learning Rust been like? Good, bad, ugly?

**Anthony:** Um, it’s made my C+ + better.

**Chris:** Yeah.

**Anthony:** Everything thing that I struggled with in Rust was really just a lesson for what I could be doing better in other places.

**Chris:** What are you using Rust for presently? Are you able to use it at work at all, or is it side projects entirely, still?

**Anthony:** So, a combination of hobby projects, uh, when I have time. And, a little bit at work. It’s one of those things where it is a little bit of a risk, a newer thing, so it’s been nice to try it out on some small things, see how it goes, and realize that I do like it and get excited about hoping to use it more.

**Chris:** Yeah. What kind of side projects have you been able to do?

**Anthony:** Um, when I get around to strapping a Raspberry Pi to a balloon and sending it up to the stratosphere to take some photos, that’ll be in Rust.

**Chris:** That’s awesome.

**Anthony:** I also like to play around with arduinos, and LEDs are fun, and I’m using a little bit of Rust there.

**Chris:** Cool. Is there anything in particular that’s caught your attention either with this conference or with the Rust community in general?

**Anthony:** The most exciting thing to me is meeting the people who are making the things that I enjoy using. Uh, it seems obvious when you really think about it, but, um, the things that you use are not made by some...cloud, or void, or they don’t just come out of nowhere, they’re made from real people, who really enjoy working on what they’re doing, and are really excited to talk to you about it.

**Chris:** I share that sentiment deeply. Thank you for your time!

**Anthony:** Well, thank you so much for the podcast. I really enjoy it.

**Chris:** My pleasure, and absolutely awesome, speaking of meeting people in person, it’s great to meet you in person!

Become a sponsor

Contact

]]>Mon, 14 Aug 2017 07:00:00 -0600CC87FE1E-0E80-4B8F-B022-892E25C3E260Chris KrychoMy experience with ember-cli-typescript as an example: we're all just people muddling along and doing our best.fulle021: Keeping your types under coverhttp://newrustacean.com/show_notes/e021/
Using type aliases and creating custom type wrappers for more expressive and safer code.

Become a sponsor

Contact

]]>Sun, 30 Apr 2017 20:13:06 -0600D287B357-E8CB-402A-A19B-767E819BEA14Chris KrychoBackground, TypeScript, coming to Rust, and how helpful the Rust community can be.22:50fullCYSK: RLShttp://newrustacean.com/show_notes/cysk/_3/
Where the RLS came from, what it can do, and how you can start using it today!

Notes

One major ergonomic improvement to developing in Rust in 2017 is coming via the Rust Language Service: an initiative that lets us share a common core of functionality between every editor – from Vim to VS Code and everything in between. In today's episode, I give some background on it and talk about how you can start using it today!

Become a sponsor

Contact

]]>Tue, 18 Apr 2017 12:17:37 -0600B9EC7CFA-C988-4EF8-A2F8-299CFE94726FChris KrychoWhere the RLS came from, what it can do, and how you can start using it today!11:30fulle020: Putting code in its placehttp://newrustacean.com/show_notes/e020/
How do we organize code in Rust? Where do we break it apart into modules or crates, and why?

Notes

Structuring code in a language like Rust can seem a bit more ambiguous than doing the same in a language with classes to attach all our functionality to, but in practice, the concerns are much the same: modules are namespaces, and we group by responsibility. In today's episode, I talk through that philosophy (and give some comparisons to other languages), and then look at what it looks like in practice!

Become a sponsor

Contact

]]>Sat, 01 Apr 2017 12:38:33 -060044A092E9-78BE-4760-87E2-E94A15DCF5C4Chris KrychoHow do we organize code in Rust? Where do we break it apart into modules or crates, and why? Structuring code in a language like Rust can seem a bit more ambiguous than doing the same in a language with classes to attach all our functionality to, but in practice, the concerns are much the same: modules are namespaces, and we group by *responsibility*. In today's episode, I talk through that philosophy (and give some comparisons to other languages), and then look at what it looks like in practice!20:20fullBonus 8: Giving back (by teaching)http://newrustacean.com/show_notes/bonus/_8/
On the responsibilities and opportunities we have to help others with our knowledge and abilities.

Notes

Many of us have been very blessed with opportunities and support as we learn software. We should go out of our way to share with others in kind. Today, my focus is on teaching, but there are lots of ways to "give back." And I'd love to hear your thoughts and things you're doing in that vein!

Become a sponsor

Contact

]]>Sun, 19 Mar 2017 09:00:00 -06005DED2D2B-E06E-44E6-BECC-2A401B40E78AChris KrychoOn the responsibilities and opportunities we have to help others with our knowledge and abilities. Many of us have been very blessed with opportunities and support as we learn software. We should go out of our way to share with others in kind. Today, my focus is on teaching, but there are lots of ways to "give back." And I'd love to hear *your* thoughts and things *you're* doing in that vein!13:30fulle019: Let's `Clone` a `Cow`http://newrustacean.com/show_notes/e019/

The final pieces of the story for (single-threaded) memory management in Rust.

Notes

Sometimes, we actually do need to copy types. Wouldn't it be nice if Rust gave us a convenient way to do that when it's convenient, or when the cost is low enough that the ergonomic tradeoffs are worth it? Well, perhaps unsurprisingly, it does! The Copy and Clone traits, plus the Cow type, give us everything we need!

Traits may inherit from other traits.... The syntax Circle : Shape means that types that implement Circle must also have an implementation for Shape. Multiple supertraits are separated by +, trait Circle : Shape + PartialEq { }. In an implementation of Circle for a given type T, methods can refer to Shape methods, since the typechecker checks that any type with an implementation of Circle also has an implementation of Shape...

Notes

Borrow, AsRef, and Deref are a little complicated, but they're well-worth understanding. Together, they give you tools for dealing with everything from HashMap and friends to conversions involving smart pointer types to easily using String and str or Vec and slice together.

Notes

We love the Rust compiler team. But there’s more to the Rust community, and more required for Rust to be as great as it can be, than just the language itself. We need to celebrate other libraries, and even the small ones, just as much (and maybe more) than changes to the language. We need to dig in and work on building the whole ecosystem. (The good news is, we are!)

Notes

What are the Cell and RefCell types, and when should we use them?

Today, we follow up both the detailed discussion of smart pointers in e015 and the closely related discussion in Interview 2 with Raph Levien, and look at two types you need to have a good idea how to deal with if you want to use these smart pointer types more ergonomically—that is, how to use them without feeling like you’re beating your head against a wall!

Notes

Chris chats with Raph Levien about what inspired him to build a text editor, as well as about where the rough edges in the Rust development story are today, and how we might improve them going forward.

Notes

Chris chats with Raph Levien about his background in software development, what attracted him to Rust, and how he’s using Rust to build the Xi Editor, a project which aims to be the fastest text editor out there, with native user interfaces and a Rust text engine.

The Unix philosophy emphasizes building simple, short, clear, modular, and extensible code that can be easily maintained and repurposed by developers other than its creators. The Unix philosophy favors composability as opposed to monolithic design.

Notes

This episode, I take a deep dive on strings in Rust, looking at the differences between String and &str, discussing Unicode a bit, and then expanding the discussion to think about how these types relate to the types they’re built on (like Vec).

Notes

Sometimes life goes crazy and I don’t have time to do all the technical writing required for a full episode, but I can’t get Rust off my mind, so I record an episode like this one. Where I talk a bit about how versatile Rust is and suggest some surprising ways you might be able to use it.

Become a sponsor

Contact

]]>Tue, 19 Apr 2016 05:50:00 -060038DF55F2-94FB-4CA0-8212-9C4D2897167FJust how good Rust is, and how you can learn it even if you’re busy.Just how good Rust is, and how you can learn it even if you’re busy. Notes Sometimes life goes crazy and I don’t have time to do all the technical writing required for a full episode, but I can’t get Rust off my mind, so I record an episode like this one. Where I talk a bit about how versatile Rust is and suggest some surprising ways you might be able to use it. Sponsors * Aleksey Pirogue * Chris Palmer * Derek Morr * Hamza Sheikh * Lachlan Collins * Leif Arne Storset * Luca Schmid * Micael Bergeron * Pascal Hertleif * Ralph Giles (“gillian”) * Ralph “FriarTech” Loizzo * reddraggone9 * Ryan Oleos * Vesa Kaihlavirta * William Roe (Thanks to the couple people donating who opted out of the reward tier, as well. You know who you are!) Become a sponsor * Patreon * Venom * Dwolla * Cash.me Contact * New Rustacean: * Twitter: @newrustacean * Email: hello@newrustacean.com * Chris Krycho * GitHub: chriskrycho * Twitter: @chriskrycho10:17fulle013: Staying alivehttp://newrustacean.com/show_notes/e013/
Reasoning about and using lifetimes in Rust (and why we need them)

Notes

Lifetimes are our way of reasoning about how long a given piece of data is
available and safe to use in Rust. The reason we don't have the dangling
pointer problem is that we do have lifetimes instead. They're not magic,
they're just a bit of semantics and syntax that let us specify the rules for
how long any given item lives, and how long references to data must be valid.

Become a sponsor

Contact

]]>Mon, 04 Apr 2016 17:52:21 -060020F0A4EE-7D88-4C90-8BA5-7D28FB8AF0ADChris KrychoReasoning about and using lifetimes in Rust (and why we need them) Notes Lifetimes are our way of reasoning about how long a given piece of data is available and safe to use in Rust. The reason we don't have the dangling pointer problem is that we do have lifetimes instead. They're not magic, they're just a bit of semantics and syntax that let us specify the rules for how long any given item lives, and how long references to data must be valid. Sponsors * Aleksey Pirogue * Chris Palmer * Derek Morr * Hamza Sheikh * Lachlan Collins * Leif Arne Storset * Luca Schmid * Micael Bergeron * Pascal Hertleif * Ralph Giles ("gillian") * Ralph "FriarTech" Loizzo * reddraggone9 * Ryan Oleos * Vesa Kaihlavirta * William Roe (Thanks to the couple people donating who opted out of the reward tier, as well. You know who you are!) Become a sponsor * Patreon.com/newrustacean * Venmo.com/chriskrycho * Dwolla.com/hub/chriskrycho * Cash.me/$chriskrycho Contact * New Rustacean: * Twitter: @newrustacean * Email: hello@newrustacean.com * Chris Krycho * GitHub: chriskrycho * Twitter: @chriskrycho17:40fulle012: I'm not familiar with that expressionhttp://newrustacean.com/show_notes/e012/
What it means to be an expression-oriented language, and how that works out in Rust.

Notes

Rust is an expression-oriented language. What does that mean, and how does it play out in Rust? We look at if and match blocks, discuss looping constructs, and examine functions, and then widen out to discuss how having an expression-oriented language can change the way we think about programming.

Notes

Talking about type systems! A broad and wide-ranging discussion about type systems in general, with specific examples from languages like PHP, JavaScript, Python, C, C++, Java, C♯, Haskell, and Rust!

What is a type system?

What are the kinds of things we get out of type systems?

What are the tradeoffs with different type systems?

What is Rust’s type system like?

What is especially attractive about Rust’s type system?

A comment on the C integer/character string addition example: what’s actually happening there is that the character string is an array “under the covers,” and as such has an address. C silently switches to using the memory address, which is of course just an integer, when you try to add the two together. As I said on the show: the result is nonsense (unless you’re using this as a way of operating on memory addresses), but it’s compileable nonsense. In a stricter and stronger type system, memory addresses and normal numbers shouldn’t be addable!

Become a sponsor

Contact

]]>Tue, 08 Mar 2016 08:00:00 -0700AC4E31F9-5811-4B6E-86E2-5E3ED3CE8DEFChris KrychoType systems: strong vs. weak, dynamic vs. static, and degrees of expressivity. Notes Talking about type systems! A broad and wide-ranging discussion about type systems in general, with specific examples from languages like PHP, JavaScript, Python, C, C++, Java, C♯, Haskell, and Rust! * What is a type system? * What are the kinds of things we get out of type systems? * What are the tradeoffs with different type systems? * What is Rust’s type system like? * What is especially attractive about Rust’s type system? A comment on the C integer/character string addition example: what’s actually happening there is that the character string is an array “under the covers,” and as such has an address. C silently switches to using the memory address, which is of course just an integer, when you try to add the two together. As I said on the show: the result is nonsense (unless you’re using this as a way of operating on memory addresses), but it’s compellable nonsense. In a stricter and stronger type system, memory addresses and normal numbers shouldn’t be addable! Sponsors * Aleksey Pirogue * Chris Palmer * Derek Morr * Hamza Sheikh * Lachlan Collins * Leif Arne Storset * Luca Schmid * Micael Bergeron * Pascal * Ralph Giles (“gillian”) * Ralph “FriarTech” Loizzo * reddraggone9 * Ryan Oleos * William Roe Become a sponsor * Patreon.com/newrustacean * Venmo.com/chriskrycho * Dwolla.com/hub/chriskrycho * Cash.me/$chriskrycho Contact * New Rustacean: - Twitter: @newrustacean - Email: hello@newrustacean.com * Chris Krycho - GitHub: chriskrycho - Twitter: @chriskrycho17:51fullInterview 1::Part 2 – Sean Griffinhttp://newrustacean.com/show_notes/interview/_1/part_2/
Sean Griffin on type systems and hopes for Rust's future

Notes

Chris chats with Sean Griffin about the tradeoffs between mental overhead and type safety, the expressiveness of different type systems, and some of the places where Rust currently falls down.

Corrigenda

Sean noted he could be wrong about IEnumerable<T> not having a Sum method in C♯, and post-show research indicated that he was (it's possible it was added after he had stopped doing .NET work, of course). See the documentation for details on how IEnumerable<T>.Sum it behaves in C♯ if you're curious.

As a related note, I (Chris) have done a little bit of digging on C♯ in the interval and it's fair to say that while a lot of the "ceremony" involved in writing C♯ is annoying, it's much more than just a "slightly nicer Java", and indeed is a much nicer language than my previous, limited exposure had led me to believe. It's no Rust or F♯, but its type system is substantially more capable than Java's.

Become a sponsor

Follow

]]>Mon, 15 Feb 2016 13:00:00 -07002FDF4C7A-DEC9-4642-A5FB-99D1D6726527Chris KrychoSean Griffin on Rust, Diesel, and ORMs Notes Chris chats with Sean Griffin about his programming background and initial experience with Rust, Rust’s appeal, and what he’s doing with Diesel and some of his plans for a new web framework in Rust. Sponsors - Aleksey Pirogov - Chris Palmer - Derek Morr - Hamza Sheikh - Leif Arne Storset - Luca Schmid - Micael Bergeron - Ralph Giles (“rillian”) - reddraggone9 - Ryan Ollos - William Roe Become a sponsor - Patreon - Venmo - Dwolla - Cash.me Follow - New Rustacean: - Twitter: @newrustacean - Email: hello@newrustacean.com - Chris Krycho - GitHub: chriskrycho - Twitter: @chriskrycho24:50fullBonus 3: Building as a communityhttp://newrustacean.com/show_notes/bonus/_3/
Community is one of the most important parts of a programming language community, or indeed any technical community. In this episode, I talk a bit about what happens when you don't have a good community, how Rust's community has done well so far, and then how to keep building a good community and how to build good things as a community.

Become a sponsor

Follow

]]>Sun, 31 Jan 2016 17:08:36 -0700E1508C29-D386-4AC2-AACD-10B6C716CDCCChris KrychoThe value of a good community, and how you can help Rust today. Community is one of the most important parts of a programming language community, or indeed *any* technical community. In this episode, I talk a bit about what happens when you don't have a good community, how Rust's community has done well so far, and then how to keep building a good community and how to build good things *as* a community. Sponsors - Aleksey Pirogov - Chris Palmer - Derek Morr - Hamza Sheikh - Luca Schmid - Micael Bergeron - Ralph Giles (“rillian”) - reddraggone9 - William Roe Become a sponsor - Patreon.com/newrustacean - Venmo.com/chriskrycho - Dwolla.com/hub/chriskrycho - Cash.me/$chriskrycho Follow - New Rustacean: - Twitter: @newrustacean - App.net: @newrustacean - Email: hello@newrustacean.com - Chris Krycho - Twitter: @chriskrycho - App.net: @chriskrycho12:03fulle010: Macros rule!http://newrustacean.com/show_notes/e010/
Macros rule!

Notes

Because of the way macros are exported—before name resolution on crates occurs—the documentation for the macros defined in the source for this episode occurs in the Macros section of the show_notes crate documentation, rather than within the documentation for this module. (See the Rust Book discussion of documenting macros for details.) Even so, the source is still in this module; see the implementations for details.

Become a sponsor

Follow

]]>Mon, 18 Jan 2016 08:25:00 -0700http://www.podtrac.com/pts/redirect.m4a/cdn.newrustacean.com/e010.m4aChris KrychoUsing Rust's macro system, its limitations, and its future.Using Rust's macro system, its limitations, and its future. Because of the way macros are exported—before name resolution on crates occurs—the documentation for the macros defined in the source for this episode occurs in the MACROS section of the show_notes crate documentation, rather than within the documentation for this module. (See the Rust Book discussion of documenting macros for details.) Even so, the source is still in this module; see the implementations for details. Sponsors - Aleksey Pirogov - Chris Palmer - Derek Morr - Hamza Sheikh - Luca Schmid - Micael Bergeron - Ralph Giles (“rillian”) - reddraggone9 - William Roe Become a sponsor - Patreon.com/newrustacean - Venmo.com/chriskrycho - Dwolla.com/hub/chriskrycho - Cash.me/$chriskrycho Follow - New Rustacean: - Twitter: @newrustacean - App.net: @newrustacean - Email: hello@newrustacean.com - Chris Krycho - Twitter: @chriskrycho - App.net: @chriskrycho16:32fulle009: Composing a Rustic tunehttp://newrustacean.com/show_notes/e009/
Notes

Last time, we looked at generics and traits at a high level. This time, we dig deeper on traits, looking specifically at std::iter::Iterator as an example of a powerful trait that can be composed across types, and then at how we might compose multiple traits on a single type.

We also talk about the syntax for traits, the use of marker traits, some of the things you can’t presently do with traits, and even just a smidge about the future of traits in Rust. All that in less than 20 minutes!

You’ll find today’s source example fairly interesting, I think: it’s just one type, but it uses almost every concept discussed on the show today!

Become a sponsor

Follow

]]>Sat, 09 Jan 2016 14:00:11 -0700505802A1-4F58-4C3C-A268-B1354B5B2F8EChris KrychoGetting into the nitty-gritty with Rust's traits.Notes Last time, we looked at generics and traits at a high level. This time, we dig deeper on traits, looking specifically at std::iter::Iterator as an example of a powerful trait that can be composed across types, and then at how we might compose multiple traits on a single type. We also talk about the syntax for traits, the use of marker traits, some of the things you _can’t_ presently do with traits, and even just a smidge about the _future_ of traits in Rust. All that in less than 20 minutes! You’ll find today’s source example fairly interesting, I think: it’s just one type, but it uses almost every concept discussed on the show today! Links - Nick Cameron: “Thoughts on Rust in 2016” - “Upcoming breakage starting in Rust 1.7, from RFCs 1214 and 136” - RFC 1214: Clarify (and improve) rules for projections and well-formedness - RFC 136: Ban private items in public APIs - The Rust Book: - Traits - Trait objects (dynamic dispatch) - The Rust reference: - std::iter and std::iter::Iterator - Add - Drop - PartialEq and Eq - PartialOrd and Ord - Special traits - Trait objects - RFC: impl specialization - Aaron Turon: “Specialize to reuse” Sponsors - Aleksey Pirogov - Chris Palmer - Derek Morr - Hamza Sheikh - Luca Schmid - Micael Bergeron - Ralph Giles (“rillian”) - reddraggone9 - William Roe Become a sponsor - Patreon.com/newrustacean - Venmo.com/chriskrycho - Dwolla.com/hub/chriskrycho - Cash.me/$chriskrycho Follow - New Rustacean: - Twitter: @newrustacean - App.net: @newrustacean - Email: hello@newrustacean.com - Chris Krycho - Twitter: @chriskrycho - App.net: @chriskrycho17:23fulle008: Just like something elsehttp://newrustacean.com/show_notes/e008/
Notes

In this episode we cover—at a very high level—two more fundamental concepts in Rust programming: generics and traits.

Generics gives us the abilitty to write types and functions which can be used with more than one type. Traits give us the ability to specify behavior which can be implemented for more than one type. The combination gives us powerful tools for higher-level programming constructs in Rust.

Comments on source code

Now that we have a handle on how tests work, we’ll use them to validate the behavior of our code going forward. This is great: we can show that the tests do what we think.

To today’s point, though: we actually know even apart from whether the tests run successfully that these generic functions and the associated traits are behaving as we want. Failure with generics is a compile-time error, not a runtime error.

Become a sponsor

Follow

]]>Sun, 27 Dec 2015 09:19:47 -0700C41DFF97-B4A0-4A50-89AF-4803FD50B547Chris KrychoGenerics, traits, and shared behavior in Rust.Notes In this episode we cover—at a _very_ high level—two more fundamental concepts in Rust programming: generics and traits. Generics gives us the abilitty to write types and functions which can be used with more than one type. Traits give us the ability to specify behavior which can be implemented for more than one type. The combination gives us powerful tools for higher-level programming constructs in Rust. Comments on source code Now that we have a handle on how tests work, we’ll use them to validate the behavior of our code going forward. This is great: we can show that the tests do what we think. To today’s point, though: we actually know even apart from whether the tests _run_ successfully that these generic functions and the associated traits are behaving as we want. Failure with generics is a _compile_-time error, not a runtime error. Sponsors - Chris Palmer - Derek Morr - Luca Schmid - Micael Bergeron - Ralph Giles (“rillian”) - reddraggone9 - William Roe Become a sponsor - Patreon/newrustacean - Venmo.com/chriskrycho - Dwolla.com/hub/chriskrycho - Cash.me/$chriskrycho Follow - New Rustacean: - Twitter: @newrustacean - App.net: @newrustacean - Email: hello@newrustacean.com - Chris Krycho - Twitter: @chriskrycho - App.net: @chriskrycho17:37fulle007: Testifyhttp://newrustacean.com/show_notes/e007/
Notes

All about testing in Rust! In order, we take a look at:

Why you need tests.

Unit tests in other (dynamically-typed) languages vs. in Rust.

How to write unit tests in Rust.

How and why to write integration tests in Rust.

How and why to use benchmarks in Rust.

The detailed code samples for this episode are heavy on showing; because of the nature of test functions, you will be best off just reading the source rather than leaning heavily on the descriptions generated by rustdoc. (The descriptions are still there, but they’re much less useful than they have been in previous episodes.) In particular, the test module here is excluded because of the use of the #[cfg(test)] attribute marker on it.

Because we are using the feature-gated benchmarking functionality, the show notes “library” can now only be compiled with the Rust nightly (as of 1.5, the version current as this episode is produced).

One thing that isn’t necessarily obvious from reading the test documentation in the Rust book and Rust reference: the extern crate test statement needs to be not in this module, but at the module (lib.rs) which defines the library/crate; in this case, show_notes/lib.rs.

Become a sponsor

Follow

]]>Sun, 13 Dec 2015 10:38:36 -07009B3A138D-FE96-4A8A-A708-BDCBF1F63A3FChris KrychoTesting and benchmarking, and compiler attributes.Notes All about testing in Rust! In order, we take a look at: - Why you need tests. - Unit tests in other (dynamically-typed) languages vs. in Rust. - How to write unit tests in Rust. - How and why to write integration tests in Rust. - How and why to use benchmarks in Rust. The detailed code samples for this episode are heavy on showing; because of the nature of test functions, you will be best off just reading the source rather than leaning heavily on the descriptions generated by RUSTDOC. (The descriptions are still _there_, but they’re much less useful than they have been in previous episodes.) In particular, the test module here is excluded because of the use of the #[cfg(test)] attribute marker on it. Because we are using the feature-gated benchmarking functionality, the show notes “library” can now only be compiled with the Rust nightly (as of 1.5, the version current as this episode is produced). One thing that isn’t necessarily obvious from reading the test documentation in the Rust book and Rust reference: the extern crate test statement needs to be not in this module, but at the module (lib.rs) which defines the library/crate; in this case, show_notes/lib.rs. Sponsors - Chris Palmer - Derek Morr - Luca Schmid - Micael Bergeron - Ralph Giles (“rillian”) - reddraggone9 - William Roe Become a sponsor - Patreon.com/newrustacean - Venmo.com/chriskrycho - Dwolla.com/hub/chriskrycho - Cash.me/$chriskrycho Follow - New Rustacean: - Twitter: @newrustacean - App.net: @newrustacean - Email: hello@newrustacean.com - Chris Krycho - Twitter: @chriskrycho - App.net: @chriskrycho18:46fullBonus 2: Legacy Codehttp://newrustacean.com/show_notes/bonus/_2/
Legacy Code

Software developers spend a large part of our careers dealing with legacy code. But what is the best way to deal with legacy code? When should you rip out the old and rewrite it, and when should you opt for smaller clean-up jobs because, however ugly, what is already present works?

Sometimes, you’re doing a technical interview, and you just cannot figure out why your JavaScript function isn’t behaving like it should… and then, prompted by the interviewer, you realize that you’re not returning anything. Polyglot programming is beautiful, and wonderful, and sometimes it bites you when you aren’t looking.

Corrigenda

I accidentally called this episode 5, instead of episode 6. Whoops.

Just before the 15:00 mark, while discussing libraries, I referred to “e006.md” when I meant to say “e006.rs”. Slips of the tongue inspired by the fact that Rust (delightfully) uses Markdown for its documentation.

Become a sponsor

Follow

]]>Mon, 16 Nov 2015 08:36:26 -07006707AF5D-82F4-40D5-9DB5-7003D571EEB6Chris KrychoDesigning APIs, and using packages ("crates") and modulesDesigning APIs, and using packages (“crates”) and modules Notes Today, we are talking about modules, packages, and APIs in Rust. Taking a bit of a breather after some pretty hard material the last few weeks. For reference, the Rust book section on Crates and Modules will be very helpful. Corrigenda I accidentally called this episode 5, instead of episode 6. *Whoops.* Just before the 15:00 mark, while discussing libraries, I referred to “e006.md” when I meant to say “e006.rs”. Slips of the tongue inspired by the fact that Rust (delightfully) uses Markdown for its documentation. Sponsors - reddraggone9 - Chris Patti (Podcast.__init__) Become a sponsor - https://www.patreon.com/newrustacean - https://venmo.com/chriskrycho - dwolla.com/hub/chriskrycho - ttps://cash.me/$chriskrycho18:22fulle005: Allocate it where?http://newrustacean.com/show_notes/e005/
Allocate it where?

Date: November 8, 2015

Subject: Returning functions from other functions, and thinking about the stack, the heap, and reference types.

Notes

This episode, we look at returning functions from other functions, and as part of that discuss some basics about the stack and the heap—and why we need to care about them for returning functions.

The functions themselves are not especially interesting; they just show you the basic form you use to return functions from other functions, and how to then use them in another function. You’ll want to take a detailed look instead at the documentation for each (or just read the source!), because that’s where the meat of the discussion in this week’s code is.

Become a sponsor

Follow

]]>Sun, 08 Nov 2015 13:15:53 -07002BA666AD-2288-4599-AC61-7B545FD2C539Chris KrychoReturning functions from other functions, and thinking about the stack, the heap, and reference types.Returning functions from other functions, and thinking about the stack, the heap, and reference types. NOTES This episode, we look at returning functions from other functions, and as part of that discuss some basics about the stack and the heap—and why we need to care about them for returning functions. The functions themselves are not especially interesting; they just show you the basic form you use to return functions from other functions, and how to then use them in another function. You’ll want to take a detailed look instead at the documentation for each (or just read the source!), because that’s where the meat of the discussion in this week’s code is. SPONSORS - reddraggone9 - Chris Patti Become a sponsor - Patreon.com/newrustacean - Venmo.com/chriskrycho - Dwolla.com/hub/chriskrycho - Cash.me FOLLOW - New Rustacean: - Twitter: @newrustacean - App.net: @newrustacean - Email: hello@newrustacean.com - Chris Krycho - Twitter: @chriskrycho - App.net: @chriskrycho18:30fulle004: Functionalizedhttp://newrustacean.com/show_notes/e004/
Date: October 29, 2015

Notes

Closures

“What is a closure?” (Progammers Stack Exchange) – the first answer is the best, but the second answer may be a helpful stepping stone for people just getting their heads around this and coming from OOP languages like C++ or Java (even though I disagree with the explanation in some ways).

Follow/Support

]]>Wed, 21 Oct 2015 11:10:12 -0600E39A4582-8095-4645-8925-AB2887828F93Chris KrychoEnumerated (`enum`) types, pattern matching, and meaningful return values.No More Nulls - Date: October 21, 2015 - Subject: Enumerated (`enum`) types, pattern matching, and meaningful return values. # Notes Today’s episode discusses, in order: - Enumerated types, with an eye to the difference between structs and enums, and to the differences between enums in C and in Rust. - Pattern matching, with a focus on using them with enumerated types and some discussion about how they differ from switch blocks in C-like languages. - Using the Option and Result enumerated types with pattern matching to provide meaningful returns from functions safely. ## Order There is a specific order to the examples below, and it is _not_ the automatically-alphabetized order rendered by rustdoc. Instead, you should work through in the sequence they appear in the source: 1. RelatedishThings 2. demonstrate_basic_enumeration 3. demonstrate_match 4. get_an_option 5. demonstrate_option 6. get_a_result 7. demonstrate_result16:51fulle002: Something borrowed, something… moved?http://newrustacean.com/show_notes/e002/
Something borrowed, something… moved?

Date: October 12, 2015

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

]]>Sun, 11 Oct 2015 20:24:16 -060003DD0BB6-9615-420A-A43B-B6EB0BBCD1C4Chris KrychoBorrow a `struct` for a while. Then give it back, or keep it for yourself!Something borrowed, something… moved? * Date: October 12, 2015 * Subject: The struct data type constructor, and the basics of Rust’s “ownership” concept and “borrowing” and “moving”. * Audio: * M4A * MP3 * Ogg Follow/Support * New Rustacean: * Twitter: @newrustacean * App.net: @newrustacean * Patreon * Email: hello@newrustacean.com * Chris Krycho * Twitter: @chriskrycho * App.net: @chriskrycho 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 * rustfmt – a tool for formatting Rust code * repo * “rustfmt-ing Rust` * Reddit discussion * RFC for incremental compilation * Text of the RFC * GitHub pull request17:12fulle001: Document All the Thingshttp://newrustacean.com/show_notes/e001/
Document all the things!

Date: October 3, 2015

Subject: Documentation in general, and rustdoc and cargo doc in particular.

Follow/Support

Notes

This is a mostly-empty module, and it is intended as such. Why? Well, because almost all the sample code exists in these comments, which serve as the show notes. If you listen to the episode or take a look at the source files, you’ll see how it works!

The components below are included solely so you can see how the docstrings work with each kind of thing. Make sure to click on the names of the items: there is more documentation there. Again, take a look at the source to see how it looks in the context of a file module.

Note that this module-level docstring uses rather than `///`-style comments. This is because this docstring is documenting the item which contains it, rather than the following item. Per [Rust RFC 505][1], the preferred approach is always to use the "following" form (`///`) rather than the "containing" form (), except for module-level docs like these. (I will be following RFC 505 throughout.)

]]>Sat, 03 Oct 2015 14:04:28 -06009846F954-2459-4E89-BAF6-0DB4DA62E6D3Chris KrychoDocumentation in general, and rustdoc and cargo doc in particular.Documentation in general, and rustdoc and cargo doc in particular. Document all the things! * Date: October 3, 2015 * Subject: Documentation in general, and rustic and cargo doc in particular. * Audio: * M4A * MP3 Follow/Support * New Rustacean: * Twitter: @newrustacean * App.net: @newrustacean * Patreon * Email: hello@newrustacean.com * Chris Krycho * Twitter: @chriskrycho * App.net: @chriskrycho Notes This is a mostly-empty module, and it is intended as such. Why? Well, because almost all the sample code exists in these comments, which serve as the show notes. If you listen to the episode or take a look at the source files, you’ll see how it works! The components below are included solely so you can see how the docstrings work with each kind of thing. Make sure to click on the names of the items: there is more documentation there. Again, take a look at the source to see how it looks in the context of a file module. Note that this module-level docstring uses rather than `///`-style comments. This is because this docstring is documenting the item which contains it, rather than the following item. Per [Rust RFC 505][1], the preferred approach is always to use the &quot;following&quot; form (`///`) rather than the &quot;containing&quot; form (), except for module-level docs like these. (I will be following RFC 505 throughout.) Links * Rust and MSVC tracking issue * Other documentation tools: * Predecessors: * Python’s Sphinx tool * Oxygen * JSDoc * JavaDoc * Other new languages with Markdown tooling * Julia has a built-in documentation system * Elixir has ex_doc * Rust 1.3 release announcement * Rust’s package hosting: crates.io * Crater for testing for backwards compatibility * Semantic versioning * “Stability as a Deliverable”: Rust official blog post on version stability, backwards compatibility, and release channels. * The Rust book chapter on rustc17:06fulle000: Hello, world!http://newrustacean.com/show_notes/e000/
Hello, World!

Today’s show is pretty meta. You can skip it if you just want to start with something more technical, but I thought listeners might want to know a little about the origins of the show and my own background, so that’s what you get today. Next time, we’ll be tackling the rustdoc command in some detail.

This is an almost-empty module: we aren’t doing any fun code samples yet. I included the standard “Hello, world!” example, because how could I not? However, at some point in the future, there will be much more detailed code samples available:

Hopefully, the result will be a pretty helpful bunch of side content along with the audio of the podcast itself.

]]>Thu, 24 Sep 2015 17:14:50 -0600CCE404BC-4B4A-4F28-A687-9BCC66C08CEFChris KrychoA little about the host, and a little about the format of the show!Hello, world! * Date: September 24, 2015 * Subject: The host, the language, and the show! * Audio: * M4A * MP3 Today’s show is pretty meta. You can skip it if you just want to start with something more technical, but I thought listeners might want to know a little about the origins of the show and my own background, so that’s what you get today. Next time, we’ll be tackling the rustic command in some detail. This is an almost-empty module: we aren’t doing any fun code samples yet. I included the standard “Hello, world!” example, because how could I not? However, at some point in the future, there will be much more detailed code samples available: * in the GitHub repository for the show * in the show notes attached to each episode Hopefully, the result will be a pretty helpful bunch of side content along with the audio of the podcast itself.17:11full