Open steffahn opened 3 years ago
I had thought of foo
(was gonna call it .take()
), but since the Slot
is available unless using some of the macro sugar, I didn't feel like it was paramount: the moment the initial StackBox<'frame, _>
is dropped, the lifetime 'frame
can end, so the &'frame mut
borrow of the Slot
can end, and it can thus be reused.
That being said, the presence of sugar whereby the initial Slot
is unnameable could justify adding .take()
, and … .take_with()
(I suspect the point of using .take_with()
over .take()
is for the T : ?Sized
case)
🤔 I have marked this a good first issue, although it's implementation requires unsafe
. Still, anybody can feel free to submit a PR for this, and I will be around to review the unsafe
🙂 (otherwise I'll probably tackle this this week-end).
The name StackBox::take
sounds appropriate to me, as an associated method.
I'd like to submit
fn unpack(self) -> (T, &'frame mut Slot<T>)
Because that's what you do with boxes when you take out the contents and are left with both the empty box and the stuff
I’m not sure of what to name it. What I mean is a function with the signature
so basically the inverse of
new_in
.Perhaps slightly unrelated, but I think that a function with this signature could be pretty useful, too:
on a second thought...
foo
can even be implemented usingbar