Skip to main content

Ring

Struct Ring 

Source
pub struct Ring<P: PointTrait, const CLOCKWISE: bool = true, const CLOSED: bool = true>(pub Vec<P>);
Expand description

Default Ring — a Vec<P> newtype carrying closure and traversal direction as const generics.

Mirrors boost::geometry::model::ring<Point, ClockWise, Closed> from boost/geometry/geometries/ring.hpp:56-99. The defaults (CLOCKWISE = true, CLOSED = true) match Boost’s defaults (boost/geometry/geometries/ring.hpp:59).

Tuple Fields§

§0: Vec<P>

Implementations§

Source§

impl<P: PointTrait, const CW: bool, const CL: bool> Ring<P, CW, CL>

Source

pub const fn new() -> Self

Construct an empty ring.

Mirrors the default ring() constructor at boost/geometry/geometries/ring.hpp:71-73.

Source

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

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

Rust analogue of the iterator-range ring(Iterator, Iterator) constructor at boost/geometry/geometries/ring.hpp:76-79; 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 ring.

Plays the role of std::vector::push_back on the inherited base_type in boost/geometry/geometries/ring.hpp:63-67.

Trait Implementations§

Source§

impl<P: Clone + PointTrait, const CLOCKWISE: bool, const CLOSED: bool> Clone for Ring<P, CLOCKWISE, CLOSED>

Source§

fn clone(&self) -> Ring<P, CLOCKWISE, CLOSED>

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, const CLOCKWISE: bool, const CLOSED: bool> Debug for Ring<P, CLOCKWISE, CLOSED>

Source§

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

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

impl<P: PointTrait, const CW: bool, const CL: bool> Default for Ring<P, CW, CL>

Source§

fn default() -> Self

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

impl<P: PointTrait, const CW: bool, const CL: bool> Geometry for Ring<P, CW, CL>

Tag this concrete type as a Ring. Mirrors the traits::tag<model::ring<...>> specialisation at boost/geometry/geometries/ring.hpp:108-118.

Source§

type Kind = RingTag

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: PartialEq + PointTrait, const CLOCKWISE: bool, const CLOSED: bool> PartialEq for Ring<P, CLOCKWISE, CLOSED>

Source§

fn eq(&self, other: &Ring<P, CLOCKWISE, CLOSED>) -> 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, const CW: bool, const CL: bool> RebindGeometry<T, Cs> for Ring<Point<A, D, OldCs>, CW, CL>

Source§

type Output = Ring<Point<T, D, Cs>, CW, CL>

The corresponding rebound stock model.
Source§

impl<P: PointTrait, const CW: bool, const CL: bool> Ring for Ring<P, CW, CL>

Wire the Ring concept up. The points() iterator hands back self.0.iter()slice::Iter is already ExactSizeIterator + Clone. The closure() and point_order() methods read the two const-generic booleans, mirroring the four traits::point_order / traits::closure specialisations at boost/geometry/geometries/ring.hpp:121-168 that dispatch on the same two template parameters.

Source§

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

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

fn closure(&self) -> Closure

Whether this ring’s last point repeats its first. Read more
Source§

fn point_order(&self) -> PointOrder

The traversal direction of this ring’s boundary. Read more
Source§

impl<P: PartialEq + PointTrait, const CLOCKWISE: bool, const CLOSED: bool> StructuralPartialEq for Ring<P, CLOCKWISE, CLOSED>

Auto Trait Implementations§

§

impl<P, const CLOCKWISE: bool, const CLOSED: bool> Freeze for Ring<P, CLOCKWISE, CLOSED>

§

impl<P, const CLOCKWISE: bool, const CLOSED: bool> RefUnwindSafe for Ring<P, CLOCKWISE, CLOSED>
where P: RefUnwindSafe,

§

impl<P, const CLOCKWISE: bool, const CLOSED: bool> Send for Ring<P, CLOCKWISE, CLOSED>
where P: Send,

§

impl<P, const CLOCKWISE: bool, const CLOSED: bool> Sync for Ring<P, CLOCKWISE, CLOSED>
where P: Sync,

§

impl<P, const CLOCKWISE: bool, const CLOSED: bool> Unpin for Ring<P, CLOCKWISE, CLOSED>
where P: Unpin,

§

impl<P, const CLOCKWISE: bool, const CLOSED: bool> UnsafeUnpin for Ring<P, CLOCKWISE, CLOSED>

§

impl<P, const CLOCKWISE: bool, const CLOSED: bool> UnwindSafe for Ring<P, CLOCKWISE, CLOSED>
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.