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

Provides Rect::new() #5050

Closed
wants to merge 2 commits into from
Closed

Provides Rect::new() #5050

wants to merge 2 commits into from

Conversation

rustbasic
Copy link
Contributor

I've sometimes wondered why there's no Rect::new() , but I see no reason why it shouldn't be provided.

@Mingun
Copy link
Contributor

Mingun commented Sep 1, 2024

I think, because it may be unclear, what the numbers mean. It is:

  • position of two corners?
  • position of a corner and size?
  • position of a center and size?

Because fields of Rect are public, constructing struct directly allows to write self-documenting code.

@emilk
Copy link
Owner

emilk commented Sep 1, 2024

Rect::from_min_max already covers this, and better

@emilk emilk closed this Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants