On 11/30/13 3:25 AM, Oren Ben-Kiki wrote:
Once stack functions have nothing to do with RAII. It is about container
manipulation methods. Consider the mangle function of a hashmap for
example. It makes perfect sense to be able to access a borrowed pointer
and also consume an owned pointer inside the mangle actions. This is
currently impossible "just because".

You can use the "with" pattern, as discussed elsewhere in the thread.

But it is as common to have a container that invokes a
function exactly once on one specific member (as another example,
basically any function of the Option type that invokes an action).

That doesn't work if `Option` is to actually implement the container traits, since it has to have the same signature. And if it doesn't implement those traits, the "with" pattern works.

Patrick

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to