[rust-dev] include_sized_bin!(type, file)

2014-05-27 Thread Tommi
Could we add to the standard library a macro, say 'include_sized_bin', that would be similar to std::macros::builtin::include_bin except that you'd also give it a sized type to return (instead of a slice of u8's) and you'd get a compile time error if the size of the file is different from the

Re: [rust-dev] StrBuf and regular expressions

2014-05-27 Thread Benjamin Striegel
The use of taking S: Str is for taking things like [S], where you want to take both str and String (such as in the other post about getops()). I wouldn't be bothered with leaving the API as-is, but I don't understand where this guideline is coming from. Can you elaborate? On Mon, May 26, 2014

Re: [rust-dev] include_sized_bin!(type, file)

2014-05-27 Thread Kevin Ballard
What's the use-case for this? -Kevin On May 27, 2014, at 3:24 AM, Tommi rusty.ga...@icloud.com wrote: Could we add to the standard library a macro, say 'include_sized_bin', that would be similar to std::macros::builtin::include_bin except that you'd also give it a sized type to return

Re: [rust-dev] StrBuf and regular expressions

2014-05-27 Thread Kevin Ballard
On May 27, 2014, at 6:05 AM, Benjamin Striegel ben.strie...@gmail.com wrote: The use of taking S: Str is for taking things like [S], where you want to take both str and String (such as in the other post about getops()). I wouldn't be bothered with leaving the API as-is, but I don't

Re: [rust-dev] include_sized_bin!(type, file)

2014-05-27 Thread Tommi Tissari
I would use it for large, immutable, static lookup tables. I could use 'include_bin' and wrap any use of it in a 'std::mem::transmute', but I'd rather not. Also, I'd appreciate the sanity check for knowing the file size matches the size of the lookup table's type. E.g. static lut: [[MyStruct,

Re: [rust-dev] include_sized_bin!(type, file)

2014-05-27 Thread Kevin Ballard
Apparently include_bin!() returns a binary literal, not an actual slice. This eventually gets treated as a [u8] during type-checking, but it's apparently treated specially by trans. Given this, I think creating an include_sized_bin!() would require changing LitBinary to include an optional

Re: [rust-dev] box ref foo?

2014-05-27 Thread Oleg Eterevsky
As far as I understand (I'm a newbie too), it means that 'radius' is the reference to the value in the box. On Tue, May 27, 2014 at 10:27 AM, Tommi rusty.ga...@icloud.com wrote: What is the meaning of this 'box ref foo' syntax found in the tutorial over at

Re: [rust-dev] box ref foo?

2014-05-27 Thread Simon Sapin
On 27/05/2014 18:27, Tommi wrote: What is the meaning of this 'box ref foo' syntax found in the tutorial over at __http://doc.rust-lang.org/tutorial.html#references (Sorry for uglifying the link, my posts seem to get flagged as spam if they contain links) In short, it's: enum Shape {

[rust-dev] flowgraph-to-Rust compiler, written (mostly) in Rust

2014-05-27 Thread Ian Daniher
Hey All, Writing to share my project of late, an environment for describing and executing connected networks of processes. I've used it to build discrete-time filters, oscillators, RF modems, and more. Preliminary documentation is up at

Re: [rust-dev] box ref foo?

2014-05-27 Thread Tommi Tissari
Thanks. I had failed to realize that 'ref radius' would make 'radius' a Boxf32 value. On 27 May 2014, at 20:29, Oleg Eterevsky o...@eterevsky.com wrote: As far as I understand (I'm a newbie too), it means that 'radius' is the reference to the value in the box. On Tue, May 27, 2014 at

Re: [rust-dev] box ref foo?

2014-05-27 Thread Kevin Ballard
It actually makes radius a f32. -Kevin On May 27, 2014, at 10:42 AM, Tommi Tissari rusty.ga...@icloud.com wrote: Thanks. I had failed to realize that 'ref radius' would make 'radius' a Boxf32 value. On 27 May 2014, at 20:29, Oleg Eterevsky o...@eterevsky.com wrote: As far as I

Re: [rust-dev] StrBuf and regular expressions

2014-05-27 Thread Benjamin Striegel
What I was specifically curious about is why you seem to be against the usage of the `Str` trait as a bound on the argument to the `captures` method. On Tue, May 27, 2014 at 1:01 PM, Kevin Ballard ke...@sb.org wrote: On May 27, 2014, at 6:05 AM, Benjamin Striegel ben.strie...@gmail.com wrote:

Re: [rust-dev] 3 SF events in June: a Dinner, Game Tech Meetup, and a Spinning Trianglthon

2014-05-27 Thread Gulshan Singh
Is there anyone who's going to any of these events that will be passing by Menlo Park and would be willing to give a fellow Rust developer a ride? On Sat, May 24, 2014 at 8:03 PM, Tom Park gtomp...@gmail.com wrote: https://air.mozilla.org/search/?q=rust+meetup Removing meetup from that

Re: [rust-dev] Array of heap allocated strings for opts_present?

2014-05-27 Thread Gulshan Singh
On Mon, May 26, 2014 at 2:56 PM, Kevin Ballard ke...@sb.org wrote: All the methods that take [String] should probably be rewritten to be generic with S: Str and take [S] instead, which will allow taking either a slice of Strings or a slice of str's. I've been wanting to contribute to Rust

Re: [rust-dev] StrBuf and regular expressions

2014-05-27 Thread Kevin Ballard
On May 27, 2014, at 1:55 PM, Benjamin Striegel ben.strie...@gmail.com wrote: What I was specifically curious about is why you seem to be against the usage of the `Str` trait as a bound on the argument to the `captures` method. It adds unnecessary complexity, bloats the crate metadata with the

[rust-dev] The meaning of 'box ref foo' ?

2014-05-27 Thread Tommi
What is the meaning of this 'box ref foo' syntax found in the tutorial over at http://doc.rust-lang.org/tutorial.html#references In short, it's: enum Shape { Sphere(Boxf32) } let shape = Sphere(box 1.0f32); let r = match shape { Sphere(box ref radius) = *radius }; I thought the 'box'

Re: [rust-dev] The meaning of 'box ref foo' ?

2014-05-27 Thread Corey Richardson
As with most things in Rust, in a pattern, a keyword means the *opposite* of its normal meaning. So where `box e` in an expression will box up the result of `e`, `box p` in a pattern will unbox `p`. On Tue, May 27, 2014 at 9:50 AM, Tommi rusty.ga...@icloud.com wrote: What is the meaning of this