If I did write a macro, that would amount to the same thing as doing the
inserts at run-time (I think).
I was looking for something like: static h:HashMap<K,C> = {(K,V),(K,V).....}.
Is this possible at all? Any potential equivalents in the std/ext library to
just writing a custom map of my own to do the same?
--
Abhijeet Gaiha
http://about.me/abhijeet.gaiha
On Tuesday, 2 July 2013 at 7:10 PM, Corey Richardson wrote:
> On Tue, Jul 2, 2013 at 9:26 AM, Abhijeet Gaiha <[email protected]
> (mailto:[email protected])> wrote:
> > Hi Folks,
> >
> > Is there a way to statically initialise a LinearMap in code? Something like
> > you can do with a vector.
> > Any other suggestions to save time for inserting a fixed set of values into
> > a hash map?
> >
>
>
> LinearMap is now std::hashmap::HashMap (in 0.7 and in master). There
> is no way to have a *static* hashmap, I think (`static h: HashMap<K,
> V> = HashMap::new()`, would be immutable and useless), but you could
> write a macro that expands to a bunch of inserts into a hashmap. Not
> sure, though.
>
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev