Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate formatting parameters to each component when printing a Point #419

Merged
merged 1 commit into from Apr 2, 2020

Conversation

@Michael-F-Bryan
Copy link
Contributor

Michael-F-Bryan commented Apr 1, 2020

I was printing an Arc and noticed a Point2D doesn't respect the format parameters (in this case 3 decimal places) to the x and y components.

Notice how the radius (f64), start_angle, and sweep_angle (euclid:::Angle) only have 3 decimal places.

println!("{:.3?}", arc);

// prints
Arc { 
  centre: (-3.66006961251359,-3.6605734446738905), 
  radius: 5.000, 
  start_angle: Angle { radians: 0.523 }, 
  sweep_angle: Angle { radians: -2.094 }, 
}
@nical
Copy link
Collaborator

nical commented Apr 2, 2020

Nice, thanks! @bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented Apr 2, 2020

📌 Commit 26160be has been approved by nical

@bors-servo
Copy link
Contributor

bors-servo commented Apr 2, 2020

Testing commit 26160be with merge a7854f2...

@bors-servo
Copy link
Contributor

bors-servo commented Apr 2, 2020

☀️ Test successful - checks-travis
Approved by: nical
Pushing a7854f2 to master...

@bors-servo bors-servo merged commit a7854f2 into servo:master Apr 2, 2020
2 checks passed
2 checks passed
Travis CI - Pull Request Build Passed
Details
homu Test successful
Details
@Michael-F-Bryan Michael-F-Bryan deleted the Michael-F-Bryan:point-debug branch Apr 2, 2020
bors-servo added a commit that referenced this pull request Apr 2, 2020
Propagate formatting parameters to each components for more types

Following up on #419, ensure the Debug and Display implementations propagate formatting parameters for more of euclid's types.

This allows people to control, for example, the number of digits in the formatting syntax like `println!("{:.3?}", rect);`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.