pub struct PointN<T, const N: usize>(_);
Expand description

Point with dimensions of constant generic size N and of generic type T (Implemented as Newtype Pattern on an array see book or https://www.worthe-it.co.za/blog/2020-10-31-newtype-pattern-in-rust.html) This type only interacts with the library through the point trait, so you are free to use your own Point/Coord/Vec structures instead by implementing the (small) trait

Implementations§

source§

impl<T, const N: usize> PointN<T, N>

source

pub fn new(array: [T; N]) -> Self

Trait Implementations§

source§

impl<T, const N: usize> Add<PointN<T, N>> for PointN<T, N>where T: Add<Output = T> + Clone + Copy,

§

type Output = PointN<T, N>

The resulting type after applying the + operator.
source§

fn add(self, other: PointN<T, N>) -> PointN<T, N>

Performs the + operation. Read more
source§

impl<T, const N: usize> Add<T> for PointN<T, N>where T: Add<Output = T> + Clone + Copy,

This is not required by the Point trait or library but convenient if you want to use the type externally

§

type Output = PointN<T, N>

The resulting type after applying the + operator.
source§

fn add(self, _rhs: T) -> PointN<T, N>

Performs the + operation. Read more
source§

impl<T: Clone, const N: usize> Clone for PointN<T, N>

source§

fn clone(&self) -> PointN<T, N>

Returns a copy 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, const N: usize> Debug for PointN<T, N>

source§

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

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

impl<T: Default + Copy, const N: usize> Default for PointN<T, N>

Initialize with the Default value for the underlying type

source§

fn default() -> Self

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

impl<'a, T, const N: usize> IntoIterator for &'a mut PointN<T, N>

§

type Item = &'a mut T

The type of the elements being iterated over.
§

type IntoIter = IterMut<'a, T>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> IterMut<'a, T>

Creates an iterator from a value. Read more
source§

impl<T, const N: usize> IntoIterator for PointN<T, N>

§

type Item = T

The type of the elements being iterated over.
§

type IntoIter = IntoIter<<PointN<T, N> as IntoIterator>::Item, N>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<T, const N: usize, U> Mul<U> for PointN<T, N>where T: Mul<U, Output = T> + Clone + Copy, U: Clone + Copy,

§

type Output = PointN<T, N>

The resulting type after applying the * operator.
source§

fn mul(self, _rhs: U) -> PointN<T, N>

Performs the * operation. Read more
source§

impl<T, const N: usize> PartialEq<PointN<T, N>> for PointN<T, N>where T: PartialOrd,

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T, const N: usize> Point for PointN<T, N>where T: Float + Copy + Default + Add<T, Output = T> + Add<f64, Output = T> + Sub<T, Output = T> + Sub<f64, Output = T> + Mul<T, Output = T> + Mul<f64, Output = T> + Sum<f64> + From<f64> + Into<f64>,

§

type Scalar = f64

source§

const DIM: usize = { N }

source§

fn axis(&self, index: usize) -> Self::Scalar

Panics if index is greater than implementors dimension
source§

fn squared_length(&self) -> Self::Scalar

source§

impl<T, const N: usize> Sub<PointN<T, N>> for PointN<T, N>where T: Sub<Output = T> + Clone + Copy,

§

type Output = PointN<T, N>

The resulting type after applying the - operator.
source§

fn sub(self, other: PointN<T, N>) -> PointN<T, N>

Performs the - operation. Read more
source§

impl<T, const N: usize> Sub<T> for PointN<T, N>where T: Sub<Output = T> + Clone + Copy,

This is not required by the Point trait or library but convenient if you want to use the type externally

§

type Output = PointN<T, N>

The resulting type after applying the - operator.
source§

fn sub(self, _rhs: T) -> PointN<T, N>

Performs the - operation. Read more
source§

impl<T: Copy, const N: usize> Copy for PointN<T, N>

Auto Trait Implementations§

§

impl<T, const N: usize> RefUnwindSafe for PointN<T, N>where T: RefUnwindSafe,

§

impl<T, const N: usize> Send for PointN<T, N>where T: Send,

§

impl<T, const N: usize> Sync for PointN<T, N>where T: Sync,

§

impl<T, const N: usize> Unpin for PointN<T, N>where T: Unpin,

§

impl<T, const N: usize> UnwindSafe for PointN<T, N>where T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.