Skip to content

Commit

Permalink
Add Debug as a supertrait of Numeric
Browse files Browse the repository at this point in the history
  • Loading branch information
Skeletonxf committed Jul 14, 2024
1 parent c5d9c12 commit bff6623
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ MatrixRef type that does not conform to the no interior mutability contract.
- Added blanket impls for & and &mut references to MatrixRef and MatrixMut. Any
manual implementations of reference types implementing these traits need to
be deleted as they are now longer required and conflict with the blanket impls.
- Numeric now requires implementing types to implement Debug.

Further trait inheritance changes are planned as detailed at
https://github.com/Skeletonxf/easy-ml/issues/1 but not yet implemented.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "easy-ml"
version = "2.0.0-dev.0"
version = "2.0.0-dev.1"
authors = ["Skeletonxf <[email protected]>"]
edition = "2021"
repository = "https://github.com/Skeletonxf/easy-ml"
Expand Down
5 changes: 4 additions & 1 deletion src/numeric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use std::ops::Div;
use std::ops::Mul;
use std::ops::Neg;
use std::ops::Sub;
use std::fmt::Debug;

/**
* A trait defining what a numeric type is in terms of by value
Expand Down Expand Up @@ -134,7 +135,8 @@ pub trait Numeric:
+ ZeroOne
+ FromUsize
+ Sum
+ PartialOrd {}
+ PartialOrd
+ Debug {}

/**
* All types implemeting the operations in NumericByValue with a right hand
Expand All @@ -154,6 +156,7 @@ impl<T> Numeric for T where
+ FromUsize
+ Sum
+ PartialOrd
+ Debug
{
}

Expand Down
3 changes: 3 additions & 0 deletions src/using_custom_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ use easy_ml::matrices::Matrix;
use num_bigint::{BigInt, ToBigInt, Sign};
use num_traits::{Zero, One};
/**
* We can derive a number of traits, Clone and Debug are required to implement Numeric
*/
#[derive(Clone, Eq, PartialEq, PartialOrd, Debug)]
struct BigIntWrapper(BigInt);
Expand Down

0 comments on commit bff6623

Please sign in to comment.