-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Missing Clone bound causes compilation of 0.3.5 to fail #2
Comments
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"), |
Woah, it seems like in spite of having a dependency |
To require exactly |
Yes, that is so. However, even that doesn't help in this particular case, since |
Anyway, the fix seems to be correct, since we can only operate with integers. I'll make the patch, thank you! |
v0.3.6 with the fix has been published |
The text was updated successfully, but these errors were encountered: