Hi,

I've gotten myself in a bit of a bind.

As part of my work with shared memory with workers, I've implemented a
(relatively leaky at the moment) abstraction over Arc<RWLock<T>>, called
Pool.

Part of my abstraction requires the Clone trait be implemented for T.

However, up in the user layer, I have something that looks roughly like this

struct Agent { ... }

struct Tracker {
  Pool<&'r mut Agent>
}

At which point, the type checker complains and asks me to implement
something of this signature:

impl<'r> Clone for &'r mut Agent {

Which seems quite patently ridiculous - as if I understand things
something, I'm being asked to return a reference to something on the
*stack* of the fn clone() function. Something smells fishy here...

Some assistance and clarification would be appreciated.

Regards,
Paul
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to