Skip to content

Commit

Permalink
deprecate error which is only used by deprecated method
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkirk committed Feb 6, 2021
1 parent 6a74467 commit df01c04
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions geo-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ mod triangle;
pub use crate::triangle::Triangle;

mod rect;
#[allow(deprecated)]
pub use crate::rect::{InvalidRectCoordinatesError, Rect};

#[macro_use]
Expand Down
7 changes: 7 additions & 0 deletions geo-types/src/rect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ impl<T: CoordNum> Rect<T> {
since = "0.6.2",
note = "Use `Rect::new` instead, since `Rect::try_new` will never Error"
)]
#[allow(deprecated)]
pub fn try_new<C>(c1: C, c2: C) -> Result<Rect<T>, InvalidRectCoordinatesError>
where
C: Into<Coordinate<T>>,
Expand Down Expand Up @@ -264,11 +265,17 @@ impl<T: CoordFloat> Rect<T> {

static RECT_INVALID_BOUNDS_ERROR: &str = "Failed to create Rect: 'min' coordinate's x/y value must be smaller or equal to the 'max' x/y value";

#[deprecated(
since = "0.6.2",
note = "Use `Rect::new` instead, since `Rect::try_new` will never Error"
)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct InvalidRectCoordinatesError;

#[allow(deprecated)]
impl std::error::Error for InvalidRectCoordinatesError {}

#[allow(deprecated)]
impl std::fmt::Display for InvalidRectCoordinatesError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", RECT_INVALID_BOUNDS_ERROR)
Expand Down

0 comments on commit df01c04

Please sign in to comment.