Re:Writing a JPEG Decoder in Rust – Part 2: Implementation I
by steveklabnik on Friday August 19, 2016 @01:44PM
(#12321862)
It is required, otherwise, `collect()` doesn't know what type of collection to collect into.
This is impossible without varargs, no?
[ Parent
| on HN ]
Re:Writing a JPEG Decoder in Rust – Part 2: Implementation I
by pcwalton on Friday August 19, 2016 @01:50PM
(#12321908)
> This is impossible without varargs, no?
Nah, you'd just implement it as an impl over and over on tuples of reasonable size (up to 16 or so).
It wouldn't be elegant, but it'd work in practice.
Re:Writing a JPEG Decoder in Rust – Part 2: Implementation I
by cbreeden on Friday August 19, 2016 @08:04PM
(#12324361)
Which is what itertools does I believe https://bluss.github.io/rust-itertools/doc/itertools/struct....
Re:Writing a JPEG Decoder in Rust – Part 2: Implementation I
by steveklabnik on Friday August 19, 2016 @01:52PM
(#12321922)
Oh right, I see now.
Re:Writing a JPEG Decoder in Rust – Part 2: Implementation I
by __s on Friday August 19, 2016 @08:41PM
(#12324467)
This technique is used a lot by specs: https://github.com/slide-rs/specs/blob/master/src/join.rs#L5...
Re:Writing a JPEG Decoder in Rust – Part 2: Implementation I
by nercury on Friday August 19, 2016 @01:54PM
(#12321943)
> `collect()` doesn't know what type of collection to collect into.
Yes, unless there is some other mention of Vec, i.e. it is returned from the function.
> This is impossible without varargs, no?
Varargs would definitely help, and would allow Rust to borrow more ideas without workarounds. But one can do it manually for each tuple variant.