Giter Site home page Giter Site logo

Comments (6)

dnsl48 avatar dnsl48 commented on July 29, 2024 1

v0.3.6 with the fix has been published

from fraction.

phrohdoh avatar phrohdoh commented on July 29, 2024

These changes fixed compilation but I do not know if they are the correct, desired changes:

diff --git a/src/lib.rs b/src/lib.rs
index ed12b8c..778d3fe 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -145,7 +145,9 @@ impl fmt::Display for Sign {
 /// assert_eq! (first + second, F::new (3, 4));
 /// ```
 #[derive (Clone, Hash, Debug)]
-pub enum GenericFraction<T> {
+pub enum GenericFraction<T>
+    where T: Clone + Integer
+{
     Rational (Sign, Ratio<T>),
     Infinity (Sign),
     NaN
@@ -154,7 +156,7 @@ pub enum GenericFraction<T> {
 
 
 /// Copy semantics to be applied for the target type, but only if T also has it.
-impl<T> Copy for GenericFraction<T> where T: Copy {}
+impl<T> Copy for GenericFraction<T> where T: Copy + Integer {}
 
 
 
@@ -1522,7 +1524,7 @@ impl<T: Clone + Integer> /*Float for*/ GenericFraction<T> {
 
 
 
-impl<T: fmt::Display + Eq + One> fmt::Display for GenericFraction<T> {
+impl<T: fmt::Display + Eq + One + Clone + Integer> fmt::Display for GenericFraction<T> {
     fn fmt (&self, f: &mut fmt::Formatter) -> fmt::Result {
         match *self {
             GenericFraction::NaN => write! (f, "NaN"),

from fraction.

dnsl48 avatar dnsl48 commented on July 29, 2024

Woah, it seems like in spite of having a dependency num = 0.1.37, cargo is still trying to install the latest 0.1.40, which seems to have some breaking changes around Ratio requirements.

from fraction.

phrohdoh avatar phrohdoh commented on July 29, 2024

To require exactly 0.1.37 you want num = "=0.1.37" I believe.

from fraction.

dnsl48 avatar dnsl48 commented on July 29, 2024

Yes, that is so. However, even that doesn't help in this particular case, since num itself does only apply semver requirements for its subpackages - so the latest ratio module is going to be installed every time.

from fraction.

dnsl48 avatar dnsl48 commented on July 29, 2024

Anyway, the fix seems to be correct, since we can only operate with integers. I'll make the patch, thank you!

from fraction.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.