Skip to content

Commit 4ac8980

Browse files
committed
Making try_new methods for geometry subtypes pub(crate) and remove unused new methods
1 parent 7d2af93 commit 4ac8980

File tree

7 files changed

+8
-49
lines changed

7 files changed

+8
-49
lines changed

src/reader/geometry_collection.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ impl<'a> GeometryCollection<'a> {
2323
/// Construct a new GeometryCollection from a WKB buffer.
2424
///
2525
/// This will parse the WKB header and extract all contained geometries.
26-
pub fn try_new(buf: &'a [u8], byte_order: Endianness, dim: Dimension) -> WkbResult<Self> {
26+
pub(crate) fn try_new(
27+
buf: &'a [u8],
28+
byte_order: Endianness,
29+
dim: Dimension,
30+
) -> WkbResult<Self> {
2731
let mut offset = 0;
2832
let has_srid = has_srid(buf, byte_order, offset)?;
2933
if has_srid {

src/reader/linearring.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,10 @@ pub struct LinearRing<'a> {
4040
}
4141

4242
impl<'a> LinearRing<'a> {
43-
/// Construct a new LinearRing from a WKB buffer.
44-
///
45-
/// # Panics
46-
///
47-
/// This will panic if the WKB buffer is invalid. For fallible parsing, use
48-
/// [`try_new`](Self::try_new) instead.
49-
pub fn new(buf: &'a [u8], byte_order: Endianness, offset: u64, dim: Dimension) -> Self {
50-
Self::try_new(buf, byte_order, offset, dim).unwrap()
51-
}
52-
5343
/// Construct a new LinearRing from a WKB buffer.
5444
///
5545
/// This will parse the number of points and validate the buffer length.
56-
pub fn try_new(
46+
pub(crate) fn try_new(
5747
buf: &'a [u8],
5848
byte_order: Endianness,
5949
offset: u64,

src/reader/linestring.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,10 @@ pub struct LineString<'a> {
2828
}
2929

3030
impl<'a> LineString<'a> {
31-
/// Construct a new LineString from a WKB buffer.
32-
///
33-
/// # Panics
34-
///
35-
/// This will panic if the WKB buffer is invalid. For fallible parsing, use
36-
/// [`try_new`](Self::try_new) instead.
37-
pub fn new(buf: &'a [u8], byte_order: Endianness, offset: u64, dim: Dimension) -> Self {
38-
Self::try_new(buf, byte_order, offset, dim).unwrap()
39-
}
40-
4131
/// Construct a new LineString from a WKB buffer.
4232
///
4333
/// This will parse the WKB header and validate the buffer length.
44-
pub fn try_new(
34+
pub(crate) fn try_new(
4535
buf: &'a [u8],
4636
byte_order: Endianness,
4737
mut offset: u64,

src/reader/multilinestring.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ pub struct MultiLineString<'a> {
2121
}
2222

2323
impl<'a> MultiLineString<'a> {
24-
#[allow(dead_code)]
25-
pub(crate) fn new(buf: &'a [u8], byte_order: Endianness, dim: Dimension) -> Self {
26-
Self::try_new(buf, byte_order, dim).unwrap()
27-
}
28-
2924
pub(crate) fn try_new(
3025
buf: &'a [u8],
3126
byte_order: Endianness,

src/reader/multipoint.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ pub struct MultiPoint<'a> {
2222
}
2323

2424
impl<'a> MultiPoint<'a> {
25-
#[allow(dead_code)]
26-
pub(crate) fn new(buf: &'a [u8], byte_order: Endianness, dim: Dimension) -> Self {
27-
Self::try_new(buf, byte_order, dim).unwrap()
28-
}
29-
3025
pub(crate) fn try_new(
3126
buf: &'a [u8],
3227
byte_order: Endianness,

src/reader/multipolygon.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ pub struct MultiPolygon<'a> {
2121
}
2222

2323
impl<'a> MultiPolygon<'a> {
24-
#[allow(dead_code)]
25-
pub(crate) fn new(buf: &'a [u8], byte_order: Endianness, dim: Dimension) -> Self {
26-
Self::try_new(buf, byte_order, dim).unwrap()
27-
}
28-
2924
pub(crate) fn try_new(
3025
buf: &'a [u8],
3126
byte_order: Endianness,

src/reader/polygon.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,10 @@ pub struct Polygon<'a> {
2121
}
2222

2323
impl<'a> Polygon<'a> {
24-
/// Construct a new Polygon from a WKB buffer.
25-
///
26-
/// # Panics
27-
///
28-
/// This will panic if the WKB buffer is invalid. For fallible parsing, use
29-
/// [`try_new`](Self::try_new) instead.
30-
pub fn new(buf: &'a [u8], byte_order: Endianness, offset: u64, dim: Dimension) -> Self {
31-
Self::try_new(buf, byte_order, offset, dim).unwrap()
32-
}
33-
3424
/// Construct a new Polygon from a WKB buffer.
3525
///
3626
/// This will parse the WKB header and extract all linear rings.
37-
pub fn try_new(
27+
pub(crate) fn try_new(
3828
buf: &'a [u8],
3929
byte_order: Endianness,
4030
mut offset: u64,

0 commit comments

Comments
 (0)