upgrade to newer rust

This commit is contained in:
Robin Gloster 2014-10-22 13:35:17 +02:00
parent e2fc8aa764
commit 4e4eb62ffc
6 changed files with 34 additions and 34 deletions

View File

@ -40,7 +40,7 @@ macro_rules! dvec_impl(
#[inline]
pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [N] {
let len = self.len();
self.at.mut_slice_to(len)
self.at.slice_to_mut(len)
}
}
@ -80,7 +80,7 @@ macro_rules! dvec_impl(
#[inline]
unsafe fn unsafe_set(&mut self, i: uint, val: N) {
*self.at.as_mut_slice().unsafe_mut_ref(i) = val
*self.at.as_mut_slice().unsafe_mut(i) = val
}
}
@ -125,8 +125,8 @@ macro_rules! dvec_impl(
impl<N> IterableMut<N> for $dvec<N> {
#[inline]
fn mut_iter<'l>(&'l mut self) -> MutItems<'l, N> {
self.as_mut_slice().mut_iter()
fn iter_mut<'l>(&'l mut self) -> MutItems<'l, N> {
self.as_mut_slice().iter_mut()
}
}
@ -246,7 +246,7 @@ macro_rules! dvec_impl(
fn normalize(&mut self) -> N {
let l = Norm::norm(self);
for n in self.as_mut_slice().mut_iter() {
for n in self.as_mut_slice().iter_mut() {
*n = *n / l;
}
@ -424,7 +424,7 @@ macro_rules! small_dvec_from_impl (
let mut at: [N, ..$dim] = [ $( $zeros, )* ];
for n in at.mut_slice_to(dim).mut_iter() {
for n in at.slice_to_mut(dim).iter_mut() {
*n = elem.clone();
}
@ -446,7 +446,7 @@ macro_rules! small_dvec_from_impl (
// FIXME: not safe.
let mut at: [N, ..$dim] = [ $( $zeros, )* ];
for (curr, other) in vec.iter().zip(at.mut_iter()) {
for (curr, other) in vec.iter().zip(at.iter_mut()) {
*other = curr.clone();
}

View File

@ -20,13 +20,13 @@ macro_rules! at_fast_impl(
#[inline]
pub unsafe fn at_fast(&self, (i, j): (uint, uint)) -> N {
(*mem::transmute::<&$t<N>, &[N, ..$dim * $dim]>(self)
.unsafe_ref(i + j * $dim)).clone()
.unsafe_get(i + j * $dim)).clone()
}
#[inline]
pub unsafe fn set_fast(&mut self, (i, j): (uint, uint), val: N) {
(*mem::transmute::<&mut $t<N>, &mut [N, ..$dim * $dim]>(self)
.unsafe_mut_ref(i + j * $dim)) = val
.unsafe_mut(i + j * $dim)) = val
}
}
)
@ -151,9 +151,9 @@ macro_rules! iterable_mut_impl(
($t: ident, $dim: expr) => (
impl<N> IterableMut<N> for $t<N> {
#[inline]
fn mut_iter<'l>(&'l mut self) -> MutItems<'l, N> {
fn iter_mut<'l>(&'l mut self) -> MutItems<'l, N> {
unsafe {
mem::transmute::<&'l mut $t<N>, &'l mut [N, ..$dim * $dim]>(self).mut_iter()
mem::transmute::<&'l mut $t<N>, &'l mut [N, ..$dim * $dim]>(self).iter_mut()
}
}
}
@ -214,12 +214,12 @@ macro_rules! indexable_impl(
#[inline]
unsafe fn unsafe_at(&self, (i, j): (uint, uint)) -> N {
(*mem::transmute::<&$t<N>, &[N, ..$dim * $dim]>(self).unsafe_ref(i + j * $dim)).clone()
(*mem::transmute::<&$t<N>, &[N, ..$dim * $dim]>(self).unsafe_get(i + j * $dim)).clone()
}
#[inline]
unsafe fn unsafe_set(&mut self, (i, j): (uint, uint), val: N) {
(*mem::transmute::<&mut $t<N>, &mut [N, ..$dim * $dim]>(self).unsafe_mut_ref(i + j * $dim)) = val
(*mem::transmute::<&mut $t<N>, &mut [N, ..$dim * $dim]>(self).unsafe_mut(i + j * $dim)) = val
}
}
)
@ -276,7 +276,7 @@ macro_rules! row_impl(
fn row(&self, row: uint) -> $tv<N> {
let mut res: $tv<N> = Zero::zero();
for (i, e) in res.mut_iter().enumerate() {
for (i, e) in res.iter_mut().enumerate() {
*e = self.at((row, i));
}

View File

@ -45,7 +45,7 @@ impl<N: 'static> Iterable<N> for vec::Vec0<N> {
impl<N: 'static> IterableMut<N> for vec::Vec0<N> {
#[inline]
fn mut_iter<'l>(&'l mut self) -> MutItems<'l, N> {
fn iter_mut<'l>(&'l mut self) -> MutItems<'l, N> {
unsafe { mem::transmute::<&'l mut vec::Vec0<N>, &'l mut [N, ..0]>(self).iter_mut() }
}
}

View File

@ -42,13 +42,13 @@ macro_rules! at_fast_impl(
#[inline]
pub unsafe fn at_fast(&self, i: uint) -> N {
(*mem::transmute::<&$t<N>, &[N, ..$dim]>(self)
.unsafe_ref(i)).clone()
.unsafe_get(i)).clone()
}
/// Unsafe write access to a vector element by index.
#[inline]
pub unsafe fn set_fast(&mut self, i: uint, val: N) {
(*mem::transmute::<&mut $t<N>, &mut [N, ..$dim]>(self).unsafe_mut_ref(i)) = val
(*mem::transmute::<&mut $t<N>, &mut [N, ..$dim]>(self).unsafe_mut(i)) = val
}
}
)
@ -199,12 +199,12 @@ macro_rules! indexable_impl(
#[inline]
unsafe fn unsafe_at(&self, i: uint) -> N {
(*mem::transmute::<&$t<N>, &[N, ..$dim]>(self).unsafe_ref(i)).clone()
(*mem::transmute::<&$t<N>, &[N, ..$dim]>(self).unsafe_get(i)).clone()
}
#[inline]
unsafe fn unsafe_set(&mut self, i: uint, val: N) {
(*mem::transmute::<&mut $t<N>, &mut [N, ..$dim]>(self).unsafe_mut_ref(i)) = val
(*mem::transmute::<&mut $t<N>, &mut [N, ..$dim]>(self).unsafe_mut(i)) = val
}
}
)
@ -258,9 +258,9 @@ macro_rules! iterable_mut_impl(
($t: ident, $dim: expr) => (
impl<N> IterableMut<N> for $t<N> {
#[inline]
fn mut_iter<'l>(&'l mut self) -> MutItems<'l, N> {
fn iter_mut<'l>(&'l mut self) -> MutItems<'l, N> {
unsafe {
mem::transmute::<&'l mut $t<N>, &'l mut [N, ..$dim]>(self).mut_iter()
mem::transmute::<&'l mut $t<N>, &'l mut [N, ..$dim]>(self).iter_mut()
}
}
}

View File

@ -139,7 +139,7 @@ pub trait Iterable<N> {
/// Traits of mutable objects which can be iterated through like a vector.
pub trait IterableMut<N> {
/// Gets a vector-like read-write iterator.
fn mut_iter<'l>(&'l mut self) -> MutItems<'l, N>;
fn iter_mut<'l>(&'l mut self) -> MutItems<'l, N>;
}
/*

View File

@ -14,7 +14,7 @@ macro_rules! test_iterator_impl(
let nv: $t = v.iter().map(|e| e * n).collect();
for e in mv.mut_iter() {
for e in mv.iter_mut() {
*e = *e * n
}