Struct LineString

Source
pub struct LineString<T: WktNum = f64> { /* private fields */ }
Expand description

A parsed LineString.

Implementations§

Source§

impl<T: WktNum> LineString<T>

Source

pub fn new(coords: Vec<Coord<T>>, dim: Dimension) -> Self

Create a new LineString from a sequence of Coord and known Dimension.

Source

pub fn empty(dim: Dimension) -> Self

Create a new empty LineString.

Source

pub fn from_coords(coords: impl IntoIterator<Item = Coord<T>>) -> Option<Self>

Create a new LineString from a non-empty sequence of Coord.

This will infer the dimension from the first coordinate, and will not validate that all coordinates have the same dimension.

Returns None if the input iterator is empty.

To handle empty input iterators, consider calling unwrap_or on the result and defaulting to an empty geometry with specified dimension.

Source

pub fn dimension(&self) -> Dimension

Return the Dimension of this geometry.

Source

pub fn coords(&self) -> &[Coord<T>]

Access the coordinates of this LineString.

Source

pub fn into_inner(self) -> (Vec<Coord<T>>, Dimension)

Consume self and return the inner parts.

Trait Implementations§

Source§

impl<T: Clone + WktNum> Clone for LineString<T>

Source§

fn clone(&self) -> LineString<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + WktNum> Debug for LineString<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default + WktNum> Default for LineString<T>

Source§

fn default() -> LineString<T>

Returns the “default value” for a type. Read more
Source§

impl<T> Display for LineString<T>
where T: WktNum + Display,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a, T> From<&'a LineString<T>> for Geometry<T>
where T: CoordNum,

Available on crate feature geo-types only.
Source§

fn from(line_string: &'a LineString<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<LineString<T>> for LineString<T>
where T: CoordNum,

Available on crate feature geo-types only.
Source§

fn from(line_string: LineString<T>) -> Self

Convert from a WKT LINESTRING to a geo_types::LineString

Source§

impl<T> From<LineString<T>> for Wkt<T>
where T: WktNum,

Source§

fn from(value: LineString<T>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T: WktNum + 'a> GeometryTrait for &'a LineString<T>

Source§

type T = T

The coordinate type of this geometry
Source§

type PointType<'b> = Point<<&'a LineString<T> as GeometryTrait>::T> where Self: 'b

The type of each underlying Point, which implements PointTrait
Source§

type LineStringType<'b> = LineString<<&'a LineString<T> as GeometryTrait>::T> where Self: 'b

The type of each underlying LineString, which implements LineStringTrait
Source§

type PolygonType<'b> = Polygon<<&'a LineString<T> as GeometryTrait>::T> where Self: 'b

The type of each underlying Polygon, which implements PolygonTrait
Source§

type MultiPointType<'b> = MultiPoint<<&'a LineString<T> as GeometryTrait>::T> where Self: 'b

The type of each underlying MultiPoint, which implements MultiPointTrait
Source§

type MultiLineStringType<'b> = MultiLineString<<&'a LineString<T> as GeometryTrait>::T> where Self: 'b

The type of each underlying MultiLineString, which implements MultiLineStringTrait
Source§

type MultiPolygonType<'b> = MultiPolygon<<&'a LineString<T> as GeometryTrait>::T> where Self: 'b

The type of each underlying MultiPolygon, which implements MultiPolygonTrait
Source§

type GeometryCollectionType<'b> = GeometryCollection<<&'a LineString<T> as GeometryTrait>::T> where Self: 'b

The type of each underlying GeometryCollection, which implements GeometryCollectionTrait
Source§

type RectType<'b> = UnimplementedRect<T> where Self: 'b

The type of each underlying Rect, which implements RectTrait
Source§

type LineType<'b> = UnimplementedLine<T> where Self: 'b

The type of each underlying Line, which implements LineTrait
Source§

type TriangleType<'b> = UnimplementedTriangle<T> where Self: 'b

The type of each underlying Triangle, which implements TriangleTrait
Source§

fn dim(&self) -> Dimensions

The dimension of this geometry
Source§

fn as_type( &self, ) -> GeometryType<'_, Point<T>, LineString<T>, Polygon<T>, MultiPoint<T>, MultiLineString<T>, MultiPolygon<T>, GeometryCollection<T>, Self::RectType<'_>, Self::TriangleType<'_>, Self::LineType<'_>>

Cast this geometry to a GeometryType enum, which allows for downcasting to a specific type
Source§

impl<T: WktNum> GeometryTrait for LineString<T>

Source§

type T = T

The coordinate type of this geometry
Source§

type PointType<'b> = Point<<LineString<T> as GeometryTrait>::T> where Self: 'b

The type of each underlying Point, which implements PointTrait
Source§

type LineStringType<'b> = LineString<<LineString<T> as GeometryTrait>::T> where Self: 'b

The type of each underlying LineString, which implements LineStringTrait
Source§

type PolygonType<'b> = Polygon<<LineString<T> as GeometryTrait>::T> where Self: 'b

The type of each underlying Polygon, which implements PolygonTrait
Source§

type MultiPointType<'b> = MultiPoint<<LineString<T> as GeometryTrait>::T> where Self: 'b

The type of each underlying MultiPoint, which implements MultiPointTrait
Source§

type MultiLineStringType<'b> = MultiLineString<<LineString<T> as GeometryTrait>::T> where Self: 'b

The type of each underlying MultiLineString, which implements MultiLineStringTrait
Source§

type MultiPolygonType<'b> = MultiPolygon<<LineString<T> as GeometryTrait>::T> where Self: 'b

The type of each underlying MultiPolygon, which implements MultiPolygonTrait
Source§

type GeometryCollectionType<'b> = GeometryCollection<<LineString<T> as GeometryTrait>::T> where Self: 'b

The type of each underlying GeometryCollection, which implements GeometryCollectionTrait
Source§

type RectType<'b> = UnimplementedRect<T> where Self: 'b

The type of each underlying Rect, which implements RectTrait
Source§

type LineType<'b> = UnimplementedLine<T> where Self: 'b

The type of each underlying Line, which implements LineTrait
Source§

type TriangleType<'b> = UnimplementedTriangle<T> where Self: 'b

The type of each underlying Triangle, which implements TriangleTrait
Source§

fn dim(&self) -> Dimensions

The dimension of this geometry
Source§

fn as_type( &self, ) -> GeometryType<'_, Point<T>, LineString<T>, Polygon<T>, MultiPoint<T>, MultiLineString<T>, MultiPolygon<T>, GeometryCollection<T>, Self::RectType<'_>, Self::TriangleType<'_>, Self::LineType<'_>>

Cast this geometry to a GeometryType enum, which allows for downcasting to a specific type
Source§

impl<'a, T: WktNum> LineStringTrait for &'a LineString<T>

Source§

type CoordType<'b> = &'a Coord<T> where Self: 'b

The type of each underlying coordinate, which implements CoordTrait
Source§

fn num_coords(&self) -> usize

The number of coordinates in this LineString
Source§

unsafe fn coord_unchecked(&self, i: usize) -> Self::CoordType<'_>

Access to a specified coordinate in this LineString Read more
Source§

fn coords(&self) -> impl DoubleEndedIterator + ExactSizeIterator

An iterator over the coordinates in this LineString
Source§

fn coord(&self, i: usize) -> Option<Self::CoordType<'_>>

Access to a specified coordinate in this LineString Will return None if the provided index is out of bounds
Source§

impl<T: WktNum> LineStringTrait for LineString<T>

Source§

type CoordType<'a> = &'a Coord<T> where Self: 'a

The type of each underlying coordinate, which implements CoordTrait
Source§

fn num_coords(&self) -> usize

The number of coordinates in this LineString
Source§

unsafe fn coord_unchecked(&self, i: usize) -> Self::CoordType<'_>

Access to a specified coordinate in this LineString Read more
Source§

fn coords(&self) -> impl DoubleEndedIterator + ExactSizeIterator

An iterator over the coordinates in this LineString
Source§

fn coord(&self, i: usize) -> Option<Self::CoordType<'_>>

Access to a specified coordinate in this LineString Will return None if the provided index is out of bounds
Source§

impl<T: PartialEq + WktNum> PartialEq for LineString<T>

Source§

fn eq(&self, other: &LineString<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: WktNum> StructuralPartialEq for LineString<T>

Auto Trait Implementations§

§

impl<T> Freeze for LineString<T>

§

impl<T> RefUnwindSafe for LineString<T>
where T: RefUnwindSafe,

§

impl<T> Send for LineString<T>
where T: Send,

§

impl<T> Sync for LineString<T>
where T: Sync,

§

impl<T> Unpin for LineString<T>
where T: Unpin,

§

impl<T> UnwindSafe for LineString<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, G> ToGeoGeometry<T> for G
where T: CoordNum, G: GeometryTrait<T = T>,

Source§

fn try_to_geometry(&self) -> Option<Geometry<T>>

Convert to a geo_types Geometry. Read more
Source§

fn to_geometry(&self) -> Geometry<T>

Convert to a geo_types Geometry. Read more
Source§

impl<T, G> ToGeoLineString<T> for G
where T: CoordNum, G: LineStringTrait<T = T>,

Source§

fn to_line_string(&self) -> LineString<T>

Convert to a geo_types LineString.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.