Make from_array-like methods static.

Fix #45.
This commit is contained in:
Sébastien Crozet 2014-11-25 11:00:26 +01:00
parent 313d6f92d1
commit 40c14ace39
2 changed files with 6 additions and 6 deletions

View File

@ -36,11 +36,11 @@ macro_rules! as_array_impl(
// FIXME: because of https://github.com/rust-lang/rust/issues/16418 we cannot do the
// array-to-mat conversion by-value:
//
// pub fn from_array(&self, array: [N, ..$dim]) -> $t<N>
// pub fn from_array(array: [N, ..$dim]) -> $t<N>
/// View a column-major array of array as a vector.
#[inline]
pub fn from_array_ref(&self, array: &[[N, ..$dim], ..$dim]) -> &$t<N> {
pub fn from_array_ref(array: &[[N, ..$dim], ..$dim]) -> &$t<N> {
unsafe {
mem::transmute(array)
}
@ -48,7 +48,7 @@ macro_rules! as_array_impl(
/// View a column-major array of array as a mutable vector.
#[inline]
pub fn from_array_mut(&mut self, array: &mut [[N, ..$dim], ..$dim]) -> &mut $t<N> {
pub fn from_array_mut(array: &mut [[N, ..$dim], ..$dim]) -> &mut $t<N> {
unsafe {
mem::transmute(array)
}

View File

@ -37,11 +37,11 @@ macro_rules! as_array_impl(
// FIXME: because of https://github.com/rust-lang/rust/issues/16418 we cannot do the
// array-to-vec conversion by-value:
//
// pub fn from_array(&self, array: [N, ..$dim]) -> $t<N>
// pub fn from_array(array: [N, ..$dim]) -> $t<N>
/// View an array as a vector.
#[inline]
pub fn from_array_ref(&self, array: &[N, ..$dim]) -> &$t<N> {
pub fn from_array_ref(array: &[N, ..$dim]) -> &$t<N> {
unsafe {
mem::transmute(array)
}
@ -49,7 +49,7 @@ macro_rules! as_array_impl(
/// View an array as a vector.
#[inline]
pub fn from_array_mut(&mut self, array: &mut [N, ..$dim]) -> &mut $t<N> {
pub fn from_array_mut(array: &mut [N, ..$dim]) -> &mut $t<N> {
unsafe {
mem::transmute(array)
}