The official website for the New Rustacean podcast
OTHER License
Bot releases are hidden (Show)
Published by chriskrycho over 7 years ago
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!
(Thanks to the couple people donating who opted out of the reward tier, as
well. You know who you are!)
Published by chriskrycho over 7 years ago
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!
The typess
7.2.0.2 Moved and copied types:
When a local variable is used as an rvalue, the variable will be copied if its
type implementsCopy
. All others are moved.
Default implementations
Supertraits
from the discussion in the reference (6.1.9 Traits):
Traits may inherit from other traits.... The syntax
Circle : Shape
means that types
that implementCircle
must also have an implementation forShape
. Multiple
supertraits are separated by+
, traitCircle : Shape + PartialEq { }
. In an
implementation ofCircle
for a given typeT
, methods can refer toShape
methods,
since the typechecker checks that any type with an implementation ofCircle
also has
an implementation ofShape
...
discussion of trait super- and subtyping in the new book
(note: still to-be-written at the time this episode was published)
Marker traits
in the reference: 9 Special Traits
Previous episodes on traits:
(Thanks to the couple people donating who opted out of the reward tier, as
well. You know who you are!)
Published by chriskrycho over 7 years ago
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!
keyof
and Mapped Types in TypeScript 2.1 -- the blog post I(Thanks to the couple people donating who opted out of the reward tier, as
well. You know who you are!)
Published by chriskrycho over 7 years ago
clap
(Thanks to the couple people donating who opted out of the reward tier, as
well. You know who you are!)
Published by chriskrycho over 7 years ago
Three traits which are essential for designing good, Rustic APIs.
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.
AsRef
, Borrow
, and Deref
:
Borrow
and AsRef
in The Rust Programming Language
collections::borrow::Borrow
std::convert::AsRef
std::ops::Deref
(Thanks to the couple people donating who opted out of the reward tier, as
well. You know who you are!)
Published by chriskrycho about 8 years ago
Carol Goulding
Chris talks with Carol Goulding, a Rust community team member, co-author of the first major revision of The Rust Programming Language, and co-founder of the first Rust consultancy.
(Thanks to the couple people donating who opted out of the reward tier, as well. You know who you are!)
Published by chriskrycho about 8 years ago
It doesn't have to be sexy
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!)
futures-rs
ring
: Safe, fast, small crypto using Rustalexa-rs
: Rust library for building Alexa skillsgilrs
: Game Input Library for Rust(Thanks to the couple people donating who opted out of the reward tier, as
well. You know who you are!)
Published by chriskrycho about 8 years ago
Katas---or: learning by doing
One of the best ways to learn is to pick a small problem you have already internalized, and to do it again but in a new language or in a new way in a language you already know.
cargo-incremental
:
(Thanks to the couple people donating who opted out of the reward tier, as
well. You know who you are!)