e019: Let's `Clone` a `Cow`

EPISODE · Feb 28, 2017 · 18 MIN

e019: Let's `Clone` a `Cow`

from New Rustacean · host Chris Krycho

code{white-space: pre;} 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! Links underhanded.rs The typess std::marker::Copy "Copy types" in the book "Stack-Only Data: Copy" in the new book 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 implements Copy. All others are moved. Extended example in "Traits" section of new book std::clone::Clone std::borrow::Cow Default implementations discussion in the current book discussion in the new book 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 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... discussion of trait "inheritance" in the book discussion of trait super- and subtyping in the new book (note: still to-be-written at the time this episode was published) Marker traits std::marker in the reference: 9 Special Traits Previous episodes on traits: e008: Just like something else e009: Composing a Rustic tune Sponsors Aleksey Pirogov Andreas Fischer Andrew Thompson Austin LeSure Ben Whitley Charlie Egan Chris Palmer Christopher Giffard Daniel Collin Derek Morr Jakub "Limeth" Hlusička Jordan Henderson Jupp Müller Keith Gray Lachlan Collins Luca Schmid Matt Rudder Matthew Piziak Max Jacobson Micael Bergeron Ovidiu Curcan Pascal Hertleif Peter Tillemans Philipp Keller Ralph Giles ("rillian") Raph Levien reddraggone9 Steven Murawski Stuart Hinson Tyler Harper Vesa Kaihlavirta Vlad Bezden William Roe 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

NOW PLAYING

e019: Let's `Clone` a `Cow`

0:00 18:11

No transcript for this episode yet

We transcribe on demand. Request one and we'll notify you when it's ready — usually under 10 minutes.

The Last Outlaws Impact Studios at UTS In a History Lab season like no other, we're pulling on the threads of one of Australia's great misunderstood histories, moving beyond the myths to learn what the Aboriginal brothers Jimmy and Joe Governor faced in both life and death.Australia's budding Federation is the background setting to this remarkable story, that sees the Governor brothers tied to the inauguration of a 'new' nation and Australia's dark history of frontier violence, racial injustice and the global trade and defilement of Aboriginal ancestral remains. This Impact Studios production is a collaboration with the Governor family, UTS Faculty of Law and Jumbunna Institute for Indigenous Education and Research.The Last Outlaws teamKatherine Biber - UTS Law Professor and Chief InvestigatorAunty Loretta Parsley - Great-granddaughter of Jimmy Governor and the Governor Family Historian Leroy Parsons - Governor descendant, Narrator and Co-WriterKaitlyn Sawrey - Host, Writer and Senior ProducerFrank Lopez - Writer, The Data Engineering Show The Firebolt Data Bros The Data Engineering Show is a podcast for data engineering and BI practitioners to go beyond theory. Learn from the biggest influencers in tech about their practical day-to-day data challenges and solutions in a casual and fun setting.SEASON 1 DATA BROSEldad and Boaz Farkash shared the same stuffed toys growing up as well as a big passion for data. After founding Sisense and building it to become a high-growth analytics unicorn, they moved on to their next venture, Firebolt, a leading high-performance cloud data warehouse.SEASON 2 DATA BROSIn season 2 Eldad adopted a brilliant new little brother, and with their shared love for query processing, the connection was immediate. After excelling in his MS, Computer Science degree, Benjamin Wagner joined Firebolt to lead its query processing team and is a rising star in the data space. For inquiries contact [email protected]: https://www.firebolt.io fuzz – Swamp Jacuzzi Biggie Boutte An intoxicating wild mind trip through the past, present, and future realms of rock n roll. A euphoric cocktail of spiritual awakening through fuzz and focal points. A new dawn taking the past into the future and the future towards comforts unknown. A yesterday's tomorrow. That time is now. So free your soul and expand your mind. The key to the gates is through this sonic elixir. Administer the medicine, fasten your seatbelts and hold on tight. We have a long journey ahead. But if you want to rock it, you know it's in the pocket. You need Electrophonic Tonic. It could save your soul. Ya dig? TomCattt Thomas Patton From the beginning music has prowled with accordion lessons at a young age, followed by sax, blues harp and more recently piano, vocals, song writing and recording. Thomas Patton (AKA TomCattt) credits his mother for his stage name "TomCattt” as she was big on nick names for those she held close to her heart. TomCattt's music is best described as easy listening and sometimes retro, yet with a contemporary mix and feel. Accompanied by the creative tracks of a number of gifted musicians, his first album Hiiyaaaaaaaaaaa inspires imagination and finds a way to impress with a unique vocal sound, compelling harmony and gripping melody. The lyrical content is in fact a living reflection of this artists emotional journey that followed leaving love, finding a new love only to lose love once again. Hiiyaaaaaaaaaaa was released on June 1st, 2013 and all are invited to Soundcloud, Bandcamp, ReverbNation and Cdbaby where "A Question" is free download and to enjoy TomCattt's website tomcattt.com.
URL copied to clipboard!