You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
plus some other methods to help migrate from direct field access.
This is intended to be a non-breaking change for now, to give people an upgrade
window. In an upcoming *breaking* release of geo-types we'll drop pub field
access altogether.
This is in pursuit of adding support for 3D/4D geometries. We'll leverage
generics in a way that is intended to avoid runtime cost for our mostly 2D
user base. See #5 for more.
This commit includes a bunch of new methods that correspond to the deprecated
field access. See geo-types/CHANGES.md for a summary.
`#[inline]` hints were added to maintain performance (it's actually improved in
some places!)
geo was updated to address all the deprecations.
note = "Direct field access is deprecated - use `coord.x()` or `coord.x_mut()` for field access and `coord!(x: 1, y: 2)` or `Coordinate::new(x, y)` for construction"
32
+
)]
29
33
pubx:T,
34
+
#[deprecated(
35
+
since = "0.7.5",
36
+
note = "Direct field access is deprecated - use `coord.y()` or `coord.y_mut()` for field access and `coord!(x: 1, y: 2)` or `Coordinate::new(x, y)` for construction"
37
+
)]
30
38
puby:T,
31
39
}
32
40
41
+
impl<T:CoordNum>Coordinate<T>{
42
+
#[inline]
43
+
pubfnnew(x:T,y:T) -> Self{
44
+
// we can delete this `allow(deprecated)` once the fields are no longer pub
45
+
#[allow(deprecated)]
46
+
Self{ x, y }
47
+
}
48
+
49
+
#[inline]
50
+
pubfnx(&self) -> T{
51
+
// we can delete this `allow(deprecated)` once the fields are no longer pub
52
+
#[allow(deprecated)]
53
+
self.x
54
+
}
55
+
56
+
#[inline]
57
+
pubfnx_mut(&mutself) -> &mutT{
58
+
// we can delete this `allow(deprecated)` once the fields are no longer pub
59
+
#[allow(deprecated)]
60
+
&mutself.x
61
+
}
62
+
63
+
#[inline]
64
+
pubfny(&self) -> T{
65
+
// we can delete this `allow(deprecated)` once the fields are no longer pub
66
+
#[allow(deprecated)]
67
+
self.y
68
+
}
69
+
70
+
#[inline]
71
+
pubfny_mut(&mutself) -> &mutT{
72
+
// we can delete this `allow(deprecated)` once the fields are no longer pub
73
+
#[allow(deprecated)]
74
+
&mutself.y
75
+
}
76
+
}
77
+
33
78
impl<T:CoordNum>From<(T,T)>forCoordinate<T>{
34
79
#[inline]
35
80
fnfrom(coords:(T,T)) -> Self{
@@ -63,14 +108,14 @@ impl<T: CoordNum> From<Point<T>> for Coordinate<T> {
0 commit comments