mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-07 03:18:30 +00:00
Replace each_ref_ext
with each_ref
This commit is contained in:
parent
2cf1a0a3c0
commit
961d432f72
@ -1,6 +1,5 @@
|
|||||||
use std::{array, borrow::Borrow};
|
use std::{array, borrow::Borrow};
|
||||||
|
|
||||||
use fj_interop::ext::ArrayExt;
|
|
||||||
use fj_math::{Point, Scalar};
|
use fj_math::{Point, Scalar};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -61,7 +60,7 @@ pub trait BuildFace {
|
|||||||
array
|
array
|
||||||
};
|
};
|
||||||
let vertices = half_edges
|
let vertices = half_edges
|
||||||
.each_ref_ext()
|
.each_ref()
|
||||||
.map(|edge: &Handle<HalfEdge>| edge.start_vertex().clone());
|
.map(|edge: &Handle<HalfEdge>| edge.start_vertex().clone());
|
||||||
|
|
||||||
Polygon {
|
Polygon {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use fj_interop::ext::ArrayExt;
|
|
||||||
use fj_math::Point;
|
use fj_math::Point;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
|
||||||
@ -63,7 +62,7 @@ impl SplitFace for Shell {
|
|||||||
//
|
//
|
||||||
// Something to think about though!
|
// Something to think about though!
|
||||||
{
|
{
|
||||||
let [(a, _), (b, _)] = line.each_ref_ext();
|
let [(a, _), (b, _)] = line.each_ref();
|
||||||
|
|
||||||
let exterior = face.region().exterior();
|
let exterior = face.region().exterior();
|
||||||
|
|
||||||
|
@ -2,11 +2,6 @@
|
|||||||
|
|
||||||
/// Extension trait for arrays
|
/// Extension trait for arrays
|
||||||
pub trait ArrayExt<T, const N: usize> {
|
pub trait ArrayExt<T, const N: usize> {
|
||||||
/// Stable replacement for `each_ref`
|
|
||||||
///
|
|
||||||
/// <https://doc.rust-lang.org/std/primitive.array.html#method.each_ref>
|
|
||||||
fn each_ref_ext(&self) -> [&T; N];
|
|
||||||
|
|
||||||
/// Stable replacement for `each_mut`
|
/// Stable replacement for `each_mut`
|
||||||
///
|
///
|
||||||
/// <https://doc.rust-lang.org/std/primitive.array.html#method.each_mut>
|
/// <https://doc.rust-lang.org/std/primitive.array.html#method.each_mut>
|
||||||
@ -26,11 +21,6 @@ pub trait ArrayExt<T, const N: usize> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T> ArrayExt<T, 2> for [T; 2] {
|
impl<T> ArrayExt<T, 2> for [T; 2] {
|
||||||
fn each_ref_ext(&self) -> [&T; 2] {
|
|
||||||
let [a, b] = self;
|
|
||||||
[a, b]
|
|
||||||
}
|
|
||||||
|
|
||||||
fn each_mut_ext(&mut self) -> [&mut T; 2] {
|
fn each_mut_ext(&mut self) -> [&mut T; 2] {
|
||||||
let [a, b] = self;
|
let [a, b] = self;
|
||||||
[a, b]
|
[a, b]
|
||||||
@ -52,11 +42,6 @@ impl<T> ArrayExt<T, 2> for [T; 2] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T> ArrayExt<T, 3> for [T; 3] {
|
impl<T> ArrayExt<T, 3> for [T; 3] {
|
||||||
fn each_ref_ext(&self) -> [&T; 3] {
|
|
||||||
let [a, b, c] = self;
|
|
||||||
[a, b, c]
|
|
||||||
}
|
|
||||||
|
|
||||||
fn each_mut_ext(&mut self) -> [&mut T; 3] {
|
fn each_mut_ext(&mut self) -> [&mut T; 3] {
|
||||||
let [a, b, c] = self;
|
let [a, b, c] = self;
|
||||||
[a, b, c]
|
[a, b, c]
|
||||||
@ -78,11 +63,6 @@ impl<T> ArrayExt<T, 3> for [T; 3] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T> ArrayExt<T, 4> for [T; 4] {
|
impl<T> ArrayExt<T, 4> for [T; 4] {
|
||||||
fn each_ref_ext(&self) -> [&T; 4] {
|
|
||||||
let [a, b, c, d] = self;
|
|
||||||
[a, b, c, d]
|
|
||||||
}
|
|
||||||
|
|
||||||
fn each_mut_ext(&mut self) -> [&mut T; 4] {
|
fn each_mut_ext(&mut self) -> [&mut T; 4] {
|
||||||
let [a, b, c, d] = self;
|
let [a, b, c, d] = self;
|
||||||
[a, b, c, d]
|
[a, b, c, d]
|
||||||
|
Loading…
Reference in New Issue
Block a user