Skip to content
e025: Traits Deep Dive, Part III episode artwork

Jul 5, 2018 20 min

e025: Traits Deep Dive, Part III

from New Rustacean

Closure traits, `impl trait`, `dyn trait`, and object safety! Show Notes Sponsored by Parity Technologies! Parity is hiring Rust developers so if you’re interested, you should check out their job listings! Links RFC #1733: Trait Aliases RFC #255: Object Safety Ch. 17 in the Second Edition of The Rust Programming Language Huon Wilson’s post Example You can see all of the pieces of the final example described in the show here (and the module has the required definitions for Point). let points = vec![ Point { x: 1.0, y: 2.0 }, Point { x: 12.0, y: 4.3 }, Point { x: -5.4, y: 18.7 }, ]; let origin = Point::default(); // This is the version we start with. It works fine, but it's not elegant. let distances_inline: Vec<f32> = points .iter() .map(|point| { let change = point - &origin; (change.x.powi(2) + change.y.powi(2)).sqrt() }) .collect(); // This version is *much* cleaner! let distances_impl: Vec<f32> = points.iter().map(distance_from_impl(&origin)).collect(); Sponsors Aaron Turon Alexander Kryvomaz Alexander Payne Anthony Deschamps Anthony Scotti Antonin Carette Aleksey Pirogov Andreas Fischer Andrew Thompson Austin LeSure Behnam Esfahbod Benjamin Wasty Brent Vatne Brian Casiello Chap Lovejoy Charlie Egan Chris Jones Chris Palmer Coleman McFarland Damien Stanton Dan Abrams Daniel Collin Daniel Mason Daniel P. Clark David W. Allen David Hewson Derek Buckley Derek Morr Eugene Bulkin [Hans Fjällemark] Henri Sivonen Ian Jones Jakub “Limeth” Hlusička James Cooper Jerome Froelich John Rudnick Jon Jonathan Turner Joseph Hain Jupp Müller Justin Ossevoort Karl Hobley Keith Gray Kilian Rault Laurie Hedge Luca Schmid Luiz Irber Mark LeMoine Martin Heuschober Masashi Fujita Matt Rudder Matthew Brenner Matthias Ruszala Max Jacobson Messense Lv Micael Bergeron Nathan Sculli Nick Stevens Oluseyi Sonaiya Ovidiu Curcan Pascal Hertleif Patrick O’Doherty [Paul Naranja] Peter Tillemans Ralph Giles (“rillian”) Raj Venkalil Ramon Buckland Randy MacLeod Raph Levien reddraggone9 Robert Chrzanowski Ryan Blecher Ryan Osial Sebastián Ramírez Magrí Shane Utt Simon G. Steve Jenson Steven Knight Steven Murawski Stuart Hinson Tim Brooks Tom Prince Ty Overby Tyler Harper Vesa Kaihlavirta Victor Kruger Will Greenberg William Roe Yaacov Finkelman Zachary Snyder Zaki (Thanks to the couple people donating who opted out of the reward tier, as well. You know who you are!) Become a sponsor Patreon Venmo Dwolla Cash.me Flattr PayPal.me Contact New Rustacean: Twitter: @newrustacean Email: [email protected] Chris Krycho GitHub: chriskrycho Twitter: @chriskrycho

Episode details come from the podcast's RSS feed.

Embed this episode

Ready to play

e025: Traits Deep Dive, Part III

0:00 20:36

No transcript yet.

Requests help us decide what to transcribe next.

The Course Mentors Podcast The Course Mentors Hey there, future course creator! Ever feel like turning your know-how into an online course is like trying to solve a Rubik's cube blindfolded? Well, grab your headphones because "The Course Mentors Podcast" is here to be your secret weapon! Meet Aimee and Odette (that's us!), your new best friends in the course creation world. We've been in the trenches for over a decade, and for the last five years, we've been rocking the online course space. Now we're here to spill all our secrets in bite-sized, 15-20 minute episodes that'll fit perfectly in your coffee breaks. No fluff, no filler - just real, actionable advice that'll take you from "um, what's a landing page?" to "holy moly, I just hit six figures!". We're talking everything from crafting your course to marketing it like a pro and building a business that'll have you pinching yourself. Whether you're dreaming of ditching the 9-to-5 grind, adding a sweet extra income str CISO Perspectives (public) N2K Networks This season on CISO Perspectives, host Kim Jones explores some of the challenges of leading through uncertainty. We explore the complexity of the changing nature of regulation and working with the federal government, the evolution of privacy and fraud, and how emerging technologies like AI and quantum computing are changing cyber. When you don’t know what questions to ask, you’re afraid to ask, or don’t know who to ask, CISO Perspectives provides the foundation for learning in this brave new world. The 48 Laws of Power by Robert Greene (Full Audiobook) Robert Greene Amoral, cunning, ruthless, and instructive, this multi-million-copy New York Times bestseller is the definitive manual for anyone interested in gaining, observing, or defending against ultimate control – from the author of The Laws of Human Nature.In the book that People magazine proclaimed “beguiling” and “fascinating,” Robert Greene and Joost Elffers have distilled three thousand years of the history of power into 48 essential laws by drawing from the philosophies of Machiavelli, Sun Tzu, and Carl Von Clausewitz and also from the lives of figures ranging from Henry Kissinger to P.T. Barnum.Some laws teach the need for prudence (“Law 1: Never Outshine the Master”), others teach the value of confidence (“Law 28: Enter Action with Boldness”), and many recommend absolute self-preservation (“Law 15: Crush Your Enemy Totally”). Every law, though, has one thing in common: an interest in t

Frequently asked questions

How long is this episode of New Rustacean?

This episode is 20 minutes long.

When was this New Rustacean episode published?

This episode was published on July 5, 2018.

Can I download this New Rustacean episode?

Yes. Use the download control on the episode player to save the publisher-provided media file.