On Dec 4, 2013, at 12:23 AM, Patrick Walton <[email protected]> wrote:
> Yes, but I wouldn't worry about this restriction biting users of your
> structure too much. Rust data structures rarely ever store non-static
> references in them, as the stack discipline that references must follow is
> fairly limited. (I can probably count the number of times I've put a
> non-static `&` reference into a dynamic vector on one hand, and I don't think
> I've ever put references into a hash map.)
I've put non-static &[u8]s into a map. Specifically, I have a function in one
of my sources that looks vaguely like
pub fn process_input<'a>(input: &'a [u8]) -> int {
let mut map: HashMap<&'a [u8], int> = HashMap::new();
// .. process the input using the map, then throw away the map
return result;
}
-Kevin
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev