pub struct Wkb<'a>(/* private fields */);
Expand description
Parse a WKB byte slice into a geometry.
An opaque object that implements GeometryTrait
. Use methods provided by geo_traits
to
access the underlying data.
The contained dimension will never be Unknown
.
Implementations§
Source§impl<'a> Wkb<'a>
impl<'a> Wkb<'a>
Sourcepub fn try_new(buf: &'a [u8]) -> WkbResult<Self>
pub fn try_new(buf: &'a [u8]) -> WkbResult<Self>
Parse a WKB byte slice into a geometry.
§Performance
WKB is not a zero-copy format because coordinates are not 8-byte aligned and because an initial scan needs to take place to know internal buffer offsets.
This function does an initial pass over the WKB buffer to validate the contents and record
the byte offsets for relevant coordinate slices but does not copy the underlying data to an
alternate representation. This means that coordinates will always be constant-time to
access but not zero-copy. This is because the raw WKB buffer is not 8-byte aligned,
so when accessing a coordinate the underlying bytes need to be copied into a
newly-allocated f64
.
pub fn dimension(&self) -> Dimension
Sourcepub fn geometry_type(&self) -> GeometryType
pub fn geometry_type(&self) -> GeometryType
Return the GeometryType of this geometry.
Trait Implementations§
Source§impl<'a> GeometryTrait for &Wkb<'a>
impl<'a> GeometryTrait for &Wkb<'a>
Source§type PointType<'b> = Point<'a>
where
Self: 'b
type PointType<'b> = Point<'a> where Self: 'b
Source§type LineStringType<'b> = LineString<'a>
where
Self: 'b
type LineStringType<'b> = LineString<'a> where Self: 'b
Source§type PolygonType<'b> = Polygon<'a>
where
Self: 'b
type PolygonType<'b> = Polygon<'a> where Self: 'b
Source§type MultiPointType<'b> = MultiPoint<'a>
where
Self: 'b
type MultiPointType<'b> = MultiPoint<'a> where Self: 'b
Source§type MultiLineStringType<'b> = MultiLineString<'a>
where
Self: 'b
type MultiLineStringType<'b> = MultiLineString<'a> where Self: 'b
Source§type MultiPolygonType<'b> = MultiPolygon<'a>
where
Self: 'b
type MultiPolygonType<'b> = MultiPolygon<'a> where Self: 'b
Source§type GeometryCollectionType<'b> = GeometryCollection<'a>
where
Self: 'b
type GeometryCollectionType<'b> = GeometryCollection<'a> where Self: 'b
Source§type RectType<'b> = UnimplementedRect<f64>
where
Self: 'b
type RectType<'b> = UnimplementedRect<f64> where Self: 'b
Source§type TriangleType<'b> = UnimplementedTriangle<f64>
where
Self: 'b
type TriangleType<'b> = UnimplementedTriangle<f64> where Self: 'b
Source§type LineType<'b> = UnimplementedLine<f64>
where
Self: 'b
type LineType<'b> = UnimplementedLine<f64> where Self: 'b
Source§fn dim(&self) -> Dimensions
fn dim(&self) -> Dimensions
Source§fn as_type(
&self,
) -> GeometryType<'_, Self::PointType<'_>, Self::LineStringType<'_>, Self::PolygonType<'_>, Self::MultiPointType<'_>, Self::MultiLineStringType<'_>, Self::MultiPolygonType<'_>, Self::GeometryCollectionType<'_>, Self::RectType<'_>, Self::TriangleType<'_>, Self::LineType<'_>>
fn as_type( &self, ) -> GeometryType<'_, Self::PointType<'_>, Self::LineStringType<'_>, Self::PolygonType<'_>, Self::MultiPointType<'_>, Self::MultiLineStringType<'_>, Self::MultiPolygonType<'_>, Self::GeometryCollectionType<'_>, Self::RectType<'_>, Self::TriangleType<'_>, Self::LineType<'_>>
GeometryType
enum, which allows for downcasting to a specific
typeSource§impl<'a> GeometryTrait for Wkb<'a>
impl<'a> GeometryTrait for Wkb<'a>
Source§type PointType<'b> = Point<'a>
where
Self: 'b
type PointType<'b> = Point<'a> where Self: 'b
Source§type LineStringType<'b> = LineString<'a>
where
Self: 'b
type LineStringType<'b> = LineString<'a> where Self: 'b
Source§type PolygonType<'b> = Polygon<'a>
where
Self: 'b
type PolygonType<'b> = Polygon<'a> where Self: 'b
Source§type MultiPointType<'b> = MultiPoint<'a>
where
Self: 'b
type MultiPointType<'b> = MultiPoint<'a> where Self: 'b
Source§type MultiLineStringType<'b> = MultiLineString<'a>
where
Self: 'b
type MultiLineStringType<'b> = MultiLineString<'a> where Self: 'b
Source§type MultiPolygonType<'b> = MultiPolygon<'a>
where
Self: 'b
type MultiPolygonType<'b> = MultiPolygon<'a> where Self: 'b
Source§type GeometryCollectionType<'b> = GeometryCollection<'a>
where
Self: 'b
type GeometryCollectionType<'b> = GeometryCollection<'a> where Self: 'b
Source§type RectType<'b> = UnimplementedRect<f64>
where
Self: 'b
type RectType<'b> = UnimplementedRect<f64> where Self: 'b
Source§type TriangleType<'b> = UnimplementedTriangle<f64>
where
Self: 'b
type TriangleType<'b> = UnimplementedTriangle<f64> where Self: 'b
Source§type LineType<'b> = UnimplementedLine<f64>
where
Self: 'b
type LineType<'b> = UnimplementedLine<f64> where Self: 'b
Source§fn dim(&self) -> Dimensions
fn dim(&self) -> Dimensions
Source§fn as_type(
&self,
) -> GeometryType<'_, Self::PointType<'_>, Self::LineStringType<'_>, Self::PolygonType<'_>, Self::MultiPointType<'_>, Self::MultiLineStringType<'_>, Self::MultiPolygonType<'_>, Self::GeometryCollectionType<'_>, Self::RectType<'_>, Self::TriangleType<'_>, Self::LineType<'_>>
fn as_type( &self, ) -> GeometryType<'_, Self::PointType<'_>, Self::LineStringType<'_>, Self::PolygonType<'_>, Self::MultiPointType<'_>, Self::MultiLineStringType<'_>, Self::MultiPolygonType<'_>, Self::GeometryCollectionType<'_>, Self::RectType<'_>, Self::TriangleType<'_>, Self::LineType<'_>>
GeometryType
enum, which allows for downcasting to a specific
type