Skip to main content

PointingSegment

Struct PointingSegment 

Source
pub struct PointingSegment<'a, P: PointMut> { /* private fields */ }
Expand description

A segment borrowing two mutable endpoints instead of storing copies.

Mirrors model::pointing_segment from geometries/pointing_segment.hpp:39-72. Boost stores nullable raw pointers because its segment iterator requires default construction. Rust represents only the valid, non-null state and uses the borrow checker to prevent the endpoints from outliving their source.

Implementations§

Source§

impl<'a, P: PointMut> PointingSegment<'a, P>

Source

pub const fn new(start: &'a mut P, end: &'a mut P) -> Self

Borrow two endpoints as a segment.

Mirrors pointing_segment(p1, p2) from geometries/pointing_segment.hpp:67-71 while eliminating the C++ model’s nullable default state.

Source

pub const fn start(&self) -> &P

Borrow the first endpoint.

Source

pub const fn end(&self) -> &P

Borrow the second endpoint.

Trait Implementations§

Source§

impl<'a, P: Debug + PointMut> Debug for PointingSegment<'a, P>

Source§

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

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

impl<P: PointMut> Geometry for PointingSegment<'_, P>

Source§

type Kind = SegmentTag

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: PointMut> IndexedAccess for PointingSegment<'_, P>

Source§

fn get_indexed<const I: usize, const D: usize>(&self) -> P::Scalar

Read coordinate D of corner I. Read more
Source§

fn set_indexed<const I: usize, const D: usize>(&mut self, value: P::Scalar)

Write coordinate D of corner I. Read more
Source§

impl<P: PointMut> Segment for PointingSegment<'_, P>

Auto Trait Implementations§

§

impl<'a, P> !UnwindSafe for PointingSegment<'a, P>

§

impl<'a, P> Freeze for PointingSegment<'a, P>

§

impl<'a, P> RefUnwindSafe for PointingSegment<'a, P>
where P: RefUnwindSafe,

§

impl<'a, P> Send for PointingSegment<'a, P>
where P: Send,

§

impl<'a, P> Sync for PointingSegment<'a, P>
where P: Sync,

§

impl<'a, P> Unpin for PointingSegment<'a, P>

§

impl<'a, P> UnsafeUnpin for PointingSegment<'a, P>

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