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

Introduce Rect constructor that doesn't panic. #442

Merged
merged 2 commits into from
Apr 26, 2020
Merged

Conversation

frewsxcv
Copy link
Member

@frewsxcv frewsxcv commented Apr 25, 2020

Rect::new panics if the user supplies invalid rectangle coordinates. This pull request introduces Rect::try_new that returns an Result<Rect, _>.


Rect { min, max }
pub fn try_new<C>(min: C, max: C) -> Option<Rect<T>>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take it or leave it, but would this make more sense as a Result?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frewsxcv
Copy link
Member Author

bors r+

@bors
Copy link
Contributor

bors bot commented Apr 26, 2020

Build succeeded:

@bors bors bot merged commit 800e78c into master Apr 26, 2020
bors bot added a commit that referenced this pull request Apr 28, 2020
443: Implement BoundingRect for Point, Geometry, GeometryCollection. r=michaelkirk a=frewsxcv

This is dependent on #442

Co-authored-by: Corey Farwell <coreyf@rwell.org>
@frewsxcv frewsxcv deleted the frewsxcv-rect-new branch January 3, 2021 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants