pub struct Tri<T = i32, const N: usize = 2>(/* private fields */);
Expand description
A Triangle
with three Points.
Please see the module-level documentation for examples.
Implementations§
Source§impl<T, const N: usize> Tri<T, N>
impl<T, const N: usize> Tri<T, N>
Source§impl<T: Copy, const N: usize> Tri<T, N>
impl<T: Copy, const N: usize> Tri<T, N>
Sourcepub fn points(&self) -> [Point<T, N>; 3]
pub fn points(&self) -> [Point<T, N>; 3]
Returns Triangle
points as [Point<T, N>; 3]
.
§Example
let tri = Tri::new([10, 20], [30, 10], [20, 25]);
assert_eq!(tri.points(), [
point!(10, 20),
point!(30, 10),
point!(20, 25),
]);
Sourcepub fn points_mut(&mut self) -> &mut [Point<T, N>; 3]
pub fn points_mut(&mut self) -> &mut [Point<T, N>; 3]
Returns Triangle
points as a mutable slice &mut [Point<T, N>; 3]
.
§Example
let mut tri = Tri::new([10, 20], [30, 10], [20, 25]);
for p in tri.points_mut() {
*p += 5;
}
assert_eq!(tri.points(), [
point!(15, 25),
point!(35, 15),
point!(25, 30),
]);
Source§impl<T, const N: usize> Tri<T, N>
impl<T, const N: usize> Tri<T, N>
Sourcepub fn as_<U>(&self) -> Tri<U, N>where
U: 'static + Copy,
T: AsPrimitive<U>,
pub fn as_<U>(&self) -> Tri<U, N>where
U: 'static + Copy,
T: AsPrimitive<U>,
Returns Self
with the numbers cast using as
operator.
Converts Tri < T, N > to Tri < U, N >.
Trait Implementations§
Source§impl<'de, T, const N: usize> Deserialize<'de> for Tri<T, N>where
T: Serialize + DeserializeOwned,
impl<'de, T, const N: usize> Deserialize<'de> for Tri<T, N>where
T: Serialize + DeserializeOwned,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a, T, const N: usize> IntoIterator for &'a Tri<T, N>
impl<'a, T, const N: usize> IntoIterator for &'a Tri<T, N>
Source§impl<'a, T, const N: usize> IntoIterator for &'a mut Tri<T, N>
impl<'a, T, const N: usize> IntoIterator for &'a mut Tri<T, N>
Source§impl<T, const N: usize> IntoIterator for Tri<T, N>
impl<T, const N: usize> IntoIterator for Tri<T, N>
impl<T: Copy, const N: usize> Copy for Tri<T, N>
impl<T: Eq, const N: usize> Eq for Tri<T, N>
impl<T, const N: usize> StructuralPartialEq for Tri<T, N>
Auto Trait Implementations§
impl<T, const N: usize> Freeze for Tri<T, N>where
T: Freeze,
impl<T, const N: usize> RefUnwindSafe for Tri<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> Send for Tri<T, N>where
T: Send,
impl<T, const N: usize> Sync for Tri<T, N>where
T: Sync,
impl<T, const N: usize> Unpin for Tri<T, N>where
T: Unpin,
impl<T, const N: usize> UnwindSafe for Tri<T, N>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.