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, ..1000], ..1000] = include_sized_bin!([[MyStruct, 
..1000], ..1000], "lut_stuff.bin");

I've tried initializing my large lookup table using the normal fixed size 
vector literal syntax, but it killed the compilation time and my computer ran 
out of memory.

> On 27 May 2014, at 19:50, Kevin Ballard <[email protected]> wrote:
> 
> What's the use-case for this?
> 
> -Kevin
> 
>> On May 27, 2014, at 3:24 AM, Tommi <[email protected]> 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 (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 size of the 
>> type you specified.
>> 
>> _______________________________________________
>> Rust-dev mailing list
>> [email protected]
>> https://mail.mozilla.org/listinfo/rust-dev
> 
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to