[rust-dev] Storing Handle (for Select) in a collection causes a crash

2014-04-16 Thread Frank Huang
Hello all, I have two somewhat related questions to ask you fine folks. I'm trying to implement something that selects on a variable number of receivers, which can change during program execution. I've been attempting to do so by making Handles to those receivers and storing the handles in a

Re: [rust-dev] Storing Handle (for Select) in a collection causes a crash

2014-04-16 Thread Frank Huang
Ah, yes I failed to see the warning in the documentation. add()ing the handle after moving it into the hashmap does seem to make things better. Thanks for your help! Frank On Wed, Apr 16, 2014 at 5:45 PM, Alex Crichton a...@crichton.co wrote: unsafe { h.add(); }

[rust-dev] Is it possible to implement extension methods on existing traits?

2014-04-05 Thread Frank Huang
Hello everyone, I have a question about making extension methods on something like io::Writer. Basically, I have a data format that requires strings to be serialized as an 8-byte length header and then the string bytes themselves. Instead of having to type writer.write_u64(...);

Re: [rust-dev] Is it possible to implement extension methods on existing traits?

2014-04-05 Thread Frank Huang
{ ... } Steven Fackler On Sat, Apr 5, 2014 at 12:57 PM, Frank Huang m...@nongraphical.com wrote: Hello everyone, I have a question about making extension methods on something like io::Writer. Basically, I have a data format that requires strings to be serialized as an 8-byte length header

[rust-dev] How to import std::comm::select?

2014-02-25 Thread Frank Huang
Hi everyone, Here with a novice question. I'm trying to use the select! macro in: http://static.rust-lang.org/doc/0.9/std/comm/select/index.html And can't figure out how to get it to import. My current code looks like this: use std::comm::select; fn main() { let (p,c): (Portint, Chanint) =