Skip to main content

Linestring

Struct Linestring 

Source
#[repr(transparent)]
pub struct Linestring<P: PointTrait>(pub Vec<P>);
Expand description

Default Linestring — a Vec<P> newtype.

Mirrors boost::geometry::model::linestring<Point> from boost/geometry/geometries/linestring.hpp:54-95. The #[repr(transparent)] annotation guarantees the in-memory layout matches the underlying Vec<P>, so callers can safely transmute between the two when interfacing with code that already operates on Vec<P> directly — the same invariant Boost relies on by inheriting publicly from std::vector<Point>.

Tuple Fields§

§0: Vec<P>

Implementations§

Source§

impl<P: PointTrait> Linestring<P>

Source

pub const fn new() -> Self

Construct an empty linestring.

Mirrors the default linestring() constructor at boost/geometry/geometries/linestring.hpp:68-70.

Source

pub const fn from_vec(v: Vec<P>) -> Self

Wrap an existing Vec<P> as a linestring without copying.

Rust analogue of constructing boost::geometry::model::linestring from an iterator range (boost/geometry/geometries/linestring.hpp:73-76); the Vec is moved in rather than copied element-by-element.

Source

pub fn push(&mut self, p: P)

Append a point to the back of the linestring.

Plays the role of std::vector::push_back on the inherited base_type in boost/geometry/geometries/linestring.hpp:60-64.

Trait Implementations§

Source§

impl<P: Clone + PointTrait> Clone for Linestring<P>

Source§

fn clone(&self) -> Linestring<P>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<P: Debug + PointTrait> Debug for Linestring<P>

Source§

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

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

impl<P: PointTrait> Default for Linestring<P>

Source§

fn default() -> Self

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

impl<P: PointTrait> Geometry for Linestring<P>

Tag this concrete type as a Linestring. Mirrors the traits::tag<model::linestring<...>> specialisation at boost/geometry/geometries/linestring.hpp:103-113.

Source§

type Kind = LinestringTag

One of the *Tag types from geometry_tag. Read more
Source§

type Point = P

The point type this geometry is built from. For a value modelling Point, this is Self. Read more
Source§

impl<P: PointTrait> Linestring for Linestring<P>

Wire the Linestring concept up. The points() iterator hands back self.0.iter()slice::Iter is already ExactSizeIterator + Clone, so no adapter is needed. Plays the role of boost::begin(ls) / boost::end(ls) on model::linestring (boost/geometry/geometries/linestring.hpp:60-64).

Source§

fn points(&self) -> impl ExactSizeIterator<Item = &P> + Clone

The points of this linestring, in declared order. Read more
Source§

impl<P: PartialEq + PointTrait> PartialEq for Linestring<P>

Source§

fn eq(&self, other: &Linestring<P>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<A, const D: usize, OldCs, T, Cs> RebindGeometry<T, Cs> for Linestring<Point<A, D, OldCs>>

Source§

type Output = Linestring<Point<T, D, Cs>>

The corresponding rebound stock model.
Source§

impl<P: PartialEq + PointTrait> StructuralPartialEq for Linestring<P>

Auto Trait Implementations§

§

impl<P> Freeze for Linestring<P>

§

impl<P> RefUnwindSafe for Linestring<P>
where P: RefUnwindSafe,

§

impl<P> Send for Linestring<P>
where P: Send,

§

impl<P> Sync for Linestring<P>
where P: Sync,

§

impl<P> Unpin for Linestring<P>
where P: Unpin,

§

impl<P> UnsafeUnpin for Linestring<P>

§

impl<P> UnwindSafe for Linestring<P>
where P: 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> SameAs<T> for T

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, 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.