Rename Array1 to Array
This commit is contained in:
parent
ab24f3f8fe
commit
70dbef1eb1
4 changed files with 17 additions and 17 deletions
10
src/array.rs
10
src/array.rs
|
@ -20,10 +20,10 @@ use std::ops::*;
|
|||
use num::PartialOrd;
|
||||
|
||||
/// An array containing elements of type `Element`
|
||||
pub trait Array1 where
|
||||
pub trait Array where
|
||||
// FIXME: Ugly type signatures - blocked by rust-lang/rust#24092
|
||||
Self: Index<usize, Output = <Self as Array1>::Element>,
|
||||
Self: IndexMut<usize, Output = <Self as Array1>::Element>,
|
||||
Self: Index<usize, Output = <Self as Array>::Element>,
|
||||
Self: IndexMut<usize, Output = <Self as Array>::Element>,
|
||||
{
|
||||
type Element: Copy;
|
||||
|
||||
|
@ -53,10 +53,10 @@ pub trait Array1 where
|
|||
}
|
||||
|
||||
/// The sum of the elements of the array.
|
||||
fn sum(self) -> Self::Element where Self::Element: Add<Output = <Self as Array1>::Element>;
|
||||
fn sum(self) -> Self::Element where Self::Element: Add<Output = <Self as Array>::Element>;
|
||||
|
||||
/// The product of the elements of the array.
|
||||
fn product(self) -> Self::Element where Self::Element: Mul<Output = <Self as Array1>::Element>;
|
||||
fn product(self) -> Self::Element where Self::Element: Mul<Output = <Self as Array>::Element>;
|
||||
|
||||
/// The minimum element of the array.
|
||||
fn min(self) -> Self::Element where Self::Element: PartialOrd;
|
||||
|
|
|
@ -27,7 +27,7 @@ use rust_num::traits::cast;
|
|||
|
||||
use angle::{Rad, sin, cos, sin_cos};
|
||||
use approx::ApproxEq;
|
||||
use array::Array1;
|
||||
use array::Array;
|
||||
use num::{BaseFloat, BaseNum};
|
||||
use point::{Point, Point3};
|
||||
use quaternion::Quaternion;
|
||||
|
@ -271,9 +271,9 @@ pub trait Matrix where
|
|||
type Element: BaseFloat;
|
||||
|
||||
/// The row vector of the matrix.
|
||||
type Row: Array1<Element = Self::Element>;
|
||||
type Row: Array<Element = Self::Element>;
|
||||
/// The column vector of the matrix.
|
||||
type Column: Array1<Element = Self::Element>;
|
||||
type Column: Array<Element = Self::Element>;
|
||||
|
||||
/// The type of the transposed matrix
|
||||
type Transpose: Matrix<Element = Self::Element, Row = Self::Column, Column = Self::Row>;
|
||||
|
@ -344,7 +344,7 @@ pub trait SquareMatrix where
|
|||
/// This is used to constrain the column and rows to be of the same type in lieu of equality
|
||||
/// constraints being implemented for `where` clauses. Once those are added, this type will
|
||||
/// likely go away.
|
||||
type ColumnRow: Array1<Element = Self::Element>;
|
||||
type ColumnRow: Array<Element = Self::Element>;
|
||||
|
||||
/// Create a new diagonal matrix using the supplied value.
|
||||
fn from_value(value: Self::Element) -> Self;
|
||||
|
|
|
@ -24,7 +24,7 @@ use std::ops::*;
|
|||
use rust_num::{One, Zero};
|
||||
|
||||
use approx::ApproxEq;
|
||||
use array::Array1;
|
||||
use array::Array;
|
||||
use matrix::Matrix;
|
||||
use num::{BaseNum, BaseFloat};
|
||||
use vector::*;
|
||||
|
@ -68,7 +68,7 @@ impl<S: BaseNum> Point3<S> {
|
|||
/// Specifies the numeric operations for point types.
|
||||
pub trait Point: Copy + Clone where
|
||||
// FIXME: Ugly type signatures - blocked by rust-lang/rust#24092
|
||||
Self: Array1<Element = <Self as Point>::Scalar>,
|
||||
Self: Array<Element = <Self as Point>::Scalar>,
|
||||
// FIXME: blocked by rust-lang/rust#20671
|
||||
//
|
||||
// for<'a, 'b> &'a Self: Add<&'b V, Output = Self>,
|
||||
|
@ -130,7 +130,7 @@ pub trait Point: Copy + Clone where
|
|||
fn max(self, p: Self) -> Self;
|
||||
}
|
||||
|
||||
impl<S: BaseNum> Array1 for Point2<S> {
|
||||
impl<S: BaseNum> Array for Point2<S> {
|
||||
type Element = S;
|
||||
|
||||
fn sum(self) -> S {
|
||||
|
@ -226,7 +226,7 @@ impl<S: BaseFloat> ApproxEq for Point2<S> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<S: BaseNum> Array1 for Point3<S> {
|
||||
impl<S: BaseNum> Array for Point3<S> {
|
||||
type Element = S;
|
||||
|
||||
fn sum(self) -> S {
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
//!
|
||||
//! Several other useful methods are provided as well. Vector fields can be
|
||||
//! accessed using array syntax (i.e. `vector[0] == vector.x`), or by using
|
||||
//! the methods provided by the [`Array1`](../array/trait.Array1.html) trait.
|
||||
//! the methods provided by the [`Array`](../array/trait.Array.html) trait.
|
||||
//! This trait also provides a `map()` method for applying arbitrary functions.
|
||||
//!
|
||||
//! The [`Vector`](../trait.Vector.html) trait presents the most general
|
||||
|
@ -105,7 +105,7 @@ use rust_num::{NumCast, Zero, One};
|
|||
|
||||
use angle::{Rad, atan2, acos};
|
||||
use approx::ApproxEq;
|
||||
use array::Array1;
|
||||
use array::Array;
|
||||
use num::{BaseNum, BaseFloat, PartialOrd};
|
||||
|
||||
/// A trait that specifies a range of numeric operations for vectors. Not all
|
||||
|
@ -113,7 +113,7 @@ use num::{BaseNum, BaseFloat, PartialOrd};
|
|||
/// for pragmatic reasons.
|
||||
pub trait Vector: Copy + Clone where
|
||||
// FIXME: Ugly type signatures - blocked by rust-lang/rust#24092
|
||||
Self: Array1<Element = <Self as Vector>::Scalar>,
|
||||
Self: Array<Element = <Self as Vector>::Scalar>,
|
||||
// FIXME: blocked by rust-lang/rust#20671
|
||||
//
|
||||
// for<'a, 'b> &'a Self: Add<&'b Self, Output = Self>,
|
||||
|
@ -239,7 +239,7 @@ macro_rules! vec {
|
|||
}
|
||||
}
|
||||
|
||||
impl<S: Copy> Array1 for $VectorN<S> {
|
||||
impl<S: Copy> Array for $VectorN<S> {
|
||||
type Element = S;
|
||||
|
||||
#[inline] fn sum(self) -> S where S: Add<Output = S> { fold!(add, { $(self.$field),+ }) }
|
||||
|
|
Loading…
Reference in a new issue