Skip to content

Commit

Permalink
Implement Default, bump version to 0.5.10
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Jan 2, 2024
1 parent 8ea6a9f commit a283684
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 8 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Change Log

### v0.5.9 (XX-XX-2022)
### v0.5.10 (01-01-2024)
- implement `Default`

### v0.5.9 (02-02-2022)
- implement `AsMut<array>`

### v0.5.8 (22-10-2021)
Expand Down
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "mint"
version = "0.5.9"
version = "0.5.10"
#TODO: update to 2021 when MSRV allows
edition = "2018"
authors = [
"Benjamin Saunders <[email protected]>",
Expand All @@ -22,4 +23,4 @@ keywords = ["math"]
serde = { version = "1.0", optional = true, default-features = false }

[dev-dependencies]
serde_json = "1.0"
serde_json = "=1.0.100" # later versions use rust-2021
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ Designed to serve as an interoperability standard between libraries.
#![no_std]
#![deny(
missing_docs,
rust_2018_compatibility,
rust_2018_idioms,
future_incompatible,
nonstandard_style,
unused,
Expand Down
2 changes: 1 addition & 1 deletion src/matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::IntoMint;

macro_rules! matrix {
($name:ident : $vec:ident[ $($field:ident[$($sub:ident),*] = $index:expr),* ] = ($inner:expr, $outer:expr)) => {
#[derive(Clone, Copy, Debug, Hash, PartialEq, PartialOrd, Eq, Ord)]
#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, PartialOrd, Eq, Ord)]
#[repr(C)]
#[allow(missing_docs)] //TODO: actually have docs
pub struct $name<T> {
Expand Down
13 changes: 12 additions & 1 deletion src/rotation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use core::marker::PhantomData;
/// Standard quaternion represented by the scalar and vector parts.
/// Useful for representing rotation in 3D space.
/// Corresponds to a right-handed rotation matrix.
#[derive(Clone, Copy, Debug, Hash, PartialEq, PartialOrd, Eq, Ord)]
#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, PartialOrd, Eq, Ord)]
#[repr(C)]
pub struct Quaternion<T> {
/// Vector part of a quaternion.
Expand Down Expand Up @@ -111,6 +111,17 @@ pub enum ExtraZXZ {}
#[derive(Clone, Copy, Debug, Hash, PartialEq, PartialOrd, Eq, Ord)]
pub enum ExtraZYX {}

impl<T: Default, B> Default for EulerAngles<T, B> {
fn default() -> Self {
Self {
a: T::default(),
b: T::default(),
c: T::default(),
marker: PhantomData,
}
}
}

impl<T, B> From<[T; 3]> for EulerAngles<T, B> {
fn from([a, b, c]: [T; 3]) -> Self {
EulerAngles {
Expand Down
2 changes: 1 addition & 1 deletion src/vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::IntoMint;

macro_rules! vec {
($name:ident [ $($field:ident),* ] = $fixed:ty) => {
#[derive(Clone, Copy, Debug, Hash, PartialEq, PartialOrd, Eq, Ord)]
#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, PartialOrd, Eq, Ord)]
#[repr(C)]
#[allow(missing_docs)] //TODO: actually have docs
pub struct $name<T> {
Expand Down

0 comments on commit a283684

Please sign in to comment.