import FromBytes for glam types

This commit is contained in:
Carter Anderson 2020-05-03 17:05:45 -07:00
parent 41be55bf8d
commit 736faa3f46

View file

@ -1,4 +1,4 @@
use zerocopy::AsBytes;
use zerocopy::{FromBytes, AsBytes};
use crate::{Vec2, Vec3, Vec4, Mat2, Mat3, Mat4, Quat};
unsafe impl AsBytes for Vec2 {
@ -8,6 +8,13 @@ unsafe impl AsBytes for Vec2 {
}
unsafe impl FromBytes for Vec2 {
fn only_derive_is_allowed_to_implement_this_trait()
where
Self: Sized {}
}
unsafe impl AsBytes for Vec3 {
fn only_derive_is_allowed_to_implement_this_trait()
where
@ -15,6 +22,13 @@ unsafe impl AsBytes for Vec3 {
}
unsafe impl FromBytes for Vec3 {
fn only_derive_is_allowed_to_implement_this_trait()
where
Self: Sized {}
}
unsafe impl AsBytes for Vec4 {
fn only_derive_is_allowed_to_implement_this_trait()
where
@ -22,6 +36,13 @@ unsafe impl AsBytes for Vec4 {
}
unsafe impl FromBytes for Vec4 {
fn only_derive_is_allowed_to_implement_this_trait()
where
Self: Sized {}
}
unsafe impl AsBytes for Mat2 {
fn only_derive_is_allowed_to_implement_this_trait()
where
@ -29,6 +50,13 @@ unsafe impl AsBytes for Mat2 {
}
unsafe impl FromBytes for Mat2 {
fn only_derive_is_allowed_to_implement_this_trait()
where
Self: Sized {}
}
unsafe impl AsBytes for Mat3 {
fn only_derive_is_allowed_to_implement_this_trait()
where
@ -36,6 +64,13 @@ unsafe impl AsBytes for Mat3 {
}
unsafe impl FromBytes for Mat3 {
fn only_derive_is_allowed_to_implement_this_trait()
where
Self: Sized {}
}
unsafe impl AsBytes for Mat4 {
fn only_derive_is_allowed_to_implement_this_trait()
where
@ -43,9 +78,23 @@ unsafe impl AsBytes for Mat4 {
}
unsafe impl FromBytes for Mat4 {
fn only_derive_is_allowed_to_implement_this_trait()
where
Self: Sized {}
}
unsafe impl AsBytes for Quat {
fn only_derive_is_allowed_to_implement_this_trait()
where
Self: Sized {}
}
unsafe impl FromBytes for Quat {
fn only_derive_is_allowed_to_implement_this_trait()
where
Self: Sized {}
}