Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd += and -= support for Length (Issue #104) #107
Conversation
|
The problems with cargo output are worrying but there's nothing in this PR that should cause that. I'm going to try to kick the travis build and see what happens. |
|
@bors-servo: r+ |
|
|
Add += and -= support for Length (Issue #104) More of a learning exercise for a first try of Rust, with a few questions :) * I noticed the current tests are all in one single test function. I've added a test for each operator I added here - is there any disadvantage to more unit-like tests? * When I run `cargo test`, all 23 tests pass, but the process doesn't exit successfully? ``` Process didn't exit successfully: `/home/michael/code/rust/euclid/target/debug/euclid-9d296e662001f41b` (signal: 4) Caused by: Process didn't exit successfully: `/home/michael/code/rust/euclid/target/debug/euclid-9d296e662001f41b` (signal: 4) ``` * I assume I should also (as another PR) add *= and /=, but currently there's not length * length (only length * scalefactor). Ah - is that because it'd be returning an area unit - so really just need length *= scalefactor and length /= scalefacter right? Anyway, I can add those, but was hoping to first understand more about what complex impl's like: ``` impl<Src, Dst, T: Clone + Div<T, Output=T>> Div<Length<Src, T>> for Length<Dst, T> { ``` are trying to declare... Thanks <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/euclid/107) <!-- Reviewable:end -->
|
|
|
@jdm I'm not sure why you reopened this after merging - what else do you think should be added? I looked at *= and /= for Length, but afaict, they're not possible, as the (compile-time) type would need to change. That is, if you look at the impl of Length * ScaleFactor , the output type for Length (Dst) is different to the input type (Src), or length_mm = length_m * 1000mm/m is fine, but length_m *= 1000mm/m isn't. Or if I'm missing something, just let me know. Thanks. |
|
You got it backwards - I reopened it, and then it was merged successfully. This work is fine as it is :) |
|
Ah - right. It's just the issue that is still open - #104 . Cheers. |
absoludity commentedOct 10, 2015
More of a learning exercise for a first try of Rust, with a few questions :)
cargo test, all 23 tests pass, but the process doesn't exit successfully?are trying to declare...
Thanks