Struct diesel_mysql_spatial::data_types::LineString
source · [−]pub struct LineString {
pub srid: SRID,
pub geom: LineString<f64>,
}Expand description
A linearly interpolated path between locations.
MySQL extension: The spatial reference system identifier (SRID) may identify the used coordinate system.
Fields
srid: SRIDgeom: LineString<f64>Methods from Deref<Target = LineString<f64>>
sourcepub fn points_iter(&self) -> PointsIter<'_, T>
👎 Deprecated: Use points() instead
pub fn points_iter(&self) -> PointsIter<'_, T>
Use points() instead
Return an iterator yielding the coordinates of a LineString as Points
sourcepub fn points(&self) -> PointsIter<'_, T>
pub fn points(&self) -> PointsIter<'_, T>
Return an iterator yielding the coordinates of a LineString as Points
sourcepub fn coords(&self) -> impl Iterator<Item = &Coordinate<T>>
pub fn coords(&self) -> impl Iterator<Item = &Coordinate<T>>
Return an iterator yielding the members of a LineString as Coordinates
sourcepub fn coords_mut(&mut self) -> impl Iterator<Item = &mut Coordinate<T>>
pub fn coords_mut(&mut self) -> impl Iterator<Item = &mut Coordinate<T>>
Return an iterator yielding the coordinates of a LineString as mutable Coordinates
sourcepub fn lines(&self) -> impl ExactSizeIterator + Iterator<Item = Line<T>>
pub fn lines(&self) -> impl ExactSizeIterator + Iterator<Item = Line<T>>
Return an iterator yielding one Line for each line segment
in the LineString.
Examples
use geo_types::{coord, Line, LineString};
let mut coords = vec![(0., 0.), (5., 0.), (7., 9.)];
let line_string: LineString<f32> = coords.into_iter().collect();
let mut lines = line_string.lines();
assert_eq!(
Some(Line::new(
coord! { x: 0., y: 0. },
coord! { x: 5., y: 0. }
)),
lines.next()
);
assert_eq!(
Some(Line::new(
coord! { x: 5., y: 0. },
coord! { x: 7., y: 9. }
)),
lines.next()
);
assert!(lines.next().is_none());sourcepub fn triangles(&self) -> impl ExactSizeIterator + Iterator<Item = Triangle<T>>
pub fn triangles(&self) -> impl ExactSizeIterator + Iterator<Item = Triangle<T>>
An iterator which yields the coordinates of a LineString as Triangles
sourcepub fn close(&mut self)
pub fn close(&mut self)
Close the LineString. Specifically, if the LineString has at least one Coordinate, and
the value of the first Coordinate does not equal the value of the last Coordinate, then a
new Coordinate is added to the end with the value of the first Coordinate.
sourcepub fn num_coords(&self) -> usize
👎 Deprecated: Use geo::algorithm::coords_iter::CoordsIter::coords_count instead
pub fn num_coords(&self) -> usize
Use geo::algorithm::coords_iter::CoordsIter::coords_count instead
Return the number of coordinates in the LineString.
Examples
use geo_types::LineString;
let mut coords = vec![(0., 0.), (5., 0.), (7., 9.)];
let line_string: LineString<f32> = coords.into_iter().collect();
assert_eq!(3, line_string.num_coords());sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Checks if the linestring is closed; i.e. it is either empty or, the first and last points are the same.
Examples
use geo_types::LineString;
let mut coords = vec![(0., 0.), (5., 0.), (0., 0.)];
let line_string: LineString<f32> = coords.into_iter().collect();
assert!(line_string.is_closed());Note that we diverge from some libraries (JTS et al), which have a LinearRing type,
separate from LineString. Those libraries treat an empty LinearRing as closed by
definition, while treating an empty LineString as open. Since we don’t have a separate
LinearRing type, and use a LineString in its place, we adopt the JTS LinearRing is_closed
behavior in all places: that is, we consider an empty LineString as closed.
This is expected when used in the context of a Polygon.exterior and elsewhere; And there
seems to be no reason to maintain the separate behavior for LineStrings used in
non-LinearRing contexts.
Trait Implementations
sourceimpl AsMut<LineString<f64>> for LineString
impl AsMut<LineString<f64>> for LineString
sourcefn as_mut(&mut self) -> &mut LineString<f64>
fn as_mut(&mut self) -> &mut LineString<f64>
Converts this type into a mutable reference of the (usually inferred) input type.
sourceimpl AsRef<LineString<f64>> for LineString
impl AsRef<LineString<f64>> for LineString
sourcefn as_ref(&self) -> &LineString<f64>
fn as_ref(&self) -> &LineString<f64>
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl Clone for LineString
impl Clone for LineString
sourcefn clone(&self) -> LineString
fn clone(&self) -> LineString
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for LineString
impl Debug for LineString
sourceimpl Deref for LineString
impl Deref for LineString
sourceimpl DerefMut for LineString
impl DerefMut for LineString
sourceimpl From<LineString<f64>> for LineString
impl From<LineString<f64>> for LineString
sourcefn from(geom: LineString<f64>) -> Self
fn from(geom: LineString<f64>) -> Self
Converts to this type from the input type.
sourceimpl From<LineString> for Geometry
impl From<LineString> for Geometry
sourcefn from(other: LineString) -> Self
fn from(other: LineString) -> Self
Converts to this type from the input type.
sourceimpl FromSql<LineString, Mysql> for LineString
impl FromSql<LineString, Mysql> for LineString
sourceimpl<__ST, __DB> FromSqlRow<__ST, __DB> for LineString where
__DB: Backend,
Self: FromSql<__ST, __DB>,
impl<__ST, __DB> FromSqlRow<__ST, __DB> for LineString where
__DB: Backend,
Self: FromSql<__ST, __DB>,
sourcefn build_from_row<R: Row<__DB>>(row: &mut R) -> Result<Self>
fn build_from_row<R: Row<__DB>>(row: &mut R) -> Result<Self>
See the trait documentation.
sourceconst FIELDS_NEEDED: usize = 1usize
const FIELDS_NEEDED: usize = 1usize
The number of fields that this type will consume. Must be equal to
the number of times you would call row.take() in build_from_row Read more
sourceimpl PartialEq<LineString> for LineString
impl PartialEq<LineString> for LineString
sourcefn eq(&self, other: &LineString) -> bool
fn eq(&self, other: &LineString) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &LineString) -> bool
fn ne(&self, other: &LineString) -> bool
This method tests for !=.
sourceimpl<__ST, __DB> Queryable<__ST, __DB> for LineString where
__DB: Backend,
Self: FromSql<__ST, __DB>,
impl<__ST, __DB> Queryable<__ST, __DB> for LineString where
__DB: Backend,
Self: FromSql<__ST, __DB>,
sourceimpl ToSql<Geometry, Mysql> for LineString
impl ToSql<Geometry, Mysql> for LineString
sourceimpl ToSql<LineString, Mysql> for LineString
impl ToSql<LineString, Mysql> for LineString
sourceimpl TryFrom<Geometry> for LineString
impl TryFrom<Geometry> for LineString
impl StructuralPartialEq for LineString
Auto Trait Implementations
impl RefUnwindSafe for LineString
impl Send for LineString
impl Sync for LineString
impl Unpin for LineString
impl UnwindSafe for LineString
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> IntoSql for T
impl<T> IntoSql for T
sourcefn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
fn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
Convert self to an expression for Diesel’s query builder. Read more
sourcefn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
Convert &self to an expression for Diesel’s query builder. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more