On Wed, Sep 25, 2013 at 10:36 PM, David Brown <dav...@davidb.org> wrote:
> Let's say I'm implementing some type of map-like structure that I'd > like to be able to implement the Map trait on. > > However, my map doesn't actually store the 'V' directly, but they are > computed/retrieve/cached in some manner. > > Is this possible with the existing map trait? Given that: > > fn find<'a>(&'a self, key: &K) -> Option<&'a V>; > > doesn't the V need to be a pointer to something with the same lifetime > as self? > > Is there a way of dealing with this, or should I just implement my own > similar find function, not implementing Map, and return an Option<V> > instead? > The Map trait represents a map storing the values, so it can't be used for that use case.
_______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev