Menu
Sign In Search Podcasts Charts People & Topics Add Podcast API Pricing

Rain Paharia

👤 Person
138 total appearances

Appearances Over Time

Podcast Appearances

Oxide and Friends
Crates We Love

Um, or like a derived clone or something. And like, uh, if you have a. create which has a generic, like t colon clone, then the implementation that Rust generates is you only derive clone if t also implements clone. You only get to implement clone that way. That is like mostly what you want, but sometimes not. And so, you know, one option is you, if you don't want that clone bound, right?

Oxide and Friends
Crates We Love

Um, or like a derived clone or something. And like, uh, if you have a. create which has a generic, like t colon clone, then the implementation that Rust generates is you only derive clone if t also implements clone. You only get to implement clone that way. That is like mostly what you want, but sometimes not. And so, you know, one option is you, if you don't want that clone bound, right?

Oxide and Friends
Crates We Love

Like sometimes you're not actually storing a T in there. You are storing, say, some kind of derivative type of T. then you do that. But the one I really like that kind of automates this is derive where. So what derive where lets you do is it lets you say derive clone where sum bound. So you can say derive t clone, sorry, derive

Oxide and Friends
Crates We Love

Like sometimes you're not actually storing a T in there. You are storing, say, some kind of derivative type of T. then you do that. But the one I really like that kind of automates this is derive where. So what derive where lets you do is it lets you say derive clone where sum bound. So you can say derive t clone, sorry, derive

Oxide and Friends
Crates We Love

my type clone where T is, you know, like some implementation, some implementation of some trait that you've defined, but you can also save like, you know, you don't have any restrictions on T. So you can just do derive where clone. I remember like showing something else at a demo day and then everyone else was like, what's this derive where thing?

Oxide and Friends
Crates We Love

my type clone where T is, you know, like some implementation, some implementation of some trait that you've defined, but you can also save like, you know, you don't have any restrictions on T. So you can just do derive where clone. I remember like showing something else at a demo day and then everyone else was like, what's this derive where thing?

Oxide and Friends
Crates We Love

And then that ended up joining into the Driveware demo. It was very funny. But it's a create that I really like, and I end up reaching for it a few times a year. How does this work? As far as I can tell, it just generates a proc macro that iterates over the fields. But it just puts bounds on them. So it's just a proc macro in that sense.

Oxide and Friends
Crates We Love

And then that ended up joining into the Driveware demo. It was very funny. But it's a create that I really like, and I end up reaching for it a few times a year. How does this work? As far as I can tell, it just generates a proc macro that iterates over the fields. But it just puts bounds on them. So it's just a proc macro in that sense.

Oxide and Friends
Crates We Love

Yeah. Definitely one of my favorite little proc macros that help out.

Oxide and Friends
Crates We Love

Yeah. Definitely one of my favorite little proc macros that help out.

Oxide and Friends
Crates We Love

I think what I ended up having was I was storing a phantom data of D or something like that. So I was storing like... So I had this thing which only stored the T as a marker, so it didn't actually store any concrete values of T. And implementing something like clone for that should not require that T implement clone, right? Just logically, that is not a requirement.

Oxide and Friends
Crates We Love

I think what I ended up having was I was storing a phantom data of D or something like that. So I was storing like... So I had this thing which only stored the T as a marker, so it didn't actually store any concrete values of T. And implementing something like clone for that should not require that T implement clone, right? Just logically, that is not a requirement.

Oxide and Friends
Crates We Love

So I ended up reaching for derive where with that. That's a pretty common thing I end up having to do.

Oxide and Friends
Crates We Love

So I ended up reaching for derive where with that. That's a pretty common thing I end up having to do.

Oxide and Friends
Crates We Love

Um, I think, uh, I think what I ended up doing, God, this is telepathic crate powers.

Oxide and Friends
Crates We Love

Um, I think, uh, I think what I ended up doing, God, this is telepathic crate powers.

Oxide and Friends
Crates We Love

I think, you know, I was thinking about how I'd do that, and I feel like there's no magic, right? In this case, I ended up Googling for, I think, Rust-derived custom trait bounds or something, and derived where is in the first page of results. But, you know...

Oxide and Friends
Crates We Love

I think, you know, I was thinking about how I'd do that, and I feel like there's no magic, right? In this case, I ended up Googling for, I think, Rust-derived custom trait bounds or something, and derived where is in the first page of results. But, you know...

Oxide and Friends
Crates We Love

I'll spend a little time looking on Google and Create.io, and I'll also maybe ask some people who are there, like, I know, do you know something? And then sometimes I can't find it. It's just, it's really hard. I think one of the ways, one of the more, I think, structured ways that has helped is like,

Oxide and Friends
Crates We Love

I'll spend a little time looking on Google and Create.io, and I'll also maybe ask some people who are there, like, I know, do you know something? And then sometimes I can't find it. It's just, it's really hard. I think one of the ways, one of the more, I think, structured ways that has helped is like,