Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make mint no_std #47

Merged
merged 1 commit into from
Nov 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Mint - Math interoperability standard types.
Defines basic math types useful for computer graphics.
Designed to serve as an interoperability standard between libraries.
*/
#![no_std]
#![deny(missing_docs)]

mod matrix;
Expand Down
5 changes: 2 additions & 3 deletions src/matrix.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use vector::{Vector2, Vector3, Vector4};
use std::mem;

macro_rules! matrix {
($name:ident : $vec:ident[ $($field:ident[$($sub:ident),*] = $index:expr),* ] = ($inner:expr, $outer:expr)) => {
Expand Down Expand Up @@ -27,7 +26,7 @@ macro_rules! matrix {
}

impl<T> AsRef<[[T; $inner]; $outer]> for $name<T> {
fn as_ref(&self) -> &[[T; $inner]; $outer] { unsafe { mem::transmute(self) } }
fn as_ref(&self) -> &[[T; $inner]; $outer] { unsafe { ::core::mem::transmute(self) } }
}

impl<T: Clone> From<[T; $inner * $outer]> for $name<T> {
Expand All @@ -50,7 +49,7 @@ macro_rules! matrix {
}

impl<T> AsRef<[T; $inner * $outer]> for $name<T> {
fn as_ref(&self) -> &[T; $inner * $outer] { unsafe { mem::transmute(self) } }
fn as_ref(&self) -> &[T; $inner * $outer] { unsafe { ::core::mem::transmute(self) } }
}
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/rotation.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::marker::PhantomData;
use core::marker::PhantomData;
use vector::Vector3;


Expand Down Expand Up @@ -30,7 +30,7 @@ impl<T> Into<[T; 4]> for Quaternion<T> {
}

impl<T> AsRef<[T; 4]> for Quaternion<T> {
fn as_ref(&self) -> &[T; 4] { unsafe { ::std::mem::transmute(self) } }
fn as_ref(&self) -> &[T; 4] { unsafe { ::core::mem::transmute(self) } }
}


Expand Down
2 changes: 1 addition & 1 deletion src/vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ macro_rules! vec {
}

impl<T> AsRef<$fixed> for $name<T> {
fn as_ref(&self) -> &$fixed { unsafe { ::std::mem::transmute(self) } }
fn as_ref(&self) -> &$fixed { unsafe { ::core::mem::transmute(self) } }
}

impl<T: Clone> $name<T> {
Expand Down