1 // Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![feature(associated_types)]
17 struct Vector2<T>(T, T);
19 impl<T: Add<Output=T>> Add for Vector2<T> {
20 type Output = Vector2<T>;
22 fn add(self, other: Vector2<T>) -> Vector2<T> {
24 (Vector2(x0, y0), Vector2(x1, y1)) => {
25 Vector2(x0 + x1, y0 + y1)
36 impl<T: Add<Output=T>> Add for Vector3<T> {
37 type Output = Vector3<T>;
39 fn add(self, other: Vector3<T>) -> Vector3<T> {
55 impl<T: Add<Output=T>> Add for Matrix3x2<T> {
56 type Output = Matrix3x2<T>;
58 fn add(self, other: Matrix3x2<T>) -> Matrix3x2<T> {
68 let _: Vector2<int> = Zero::zero();
69 let _: Vector3<f64> = Zero::zero();
70 let _: Matrix3x2<u8> = Zero::zero();