Comments (7)
Agree. Scheduling that for 0.7.0
.
from fraction.
FWIW I tried my hand at this but it was a more thorough change than I had expected, since std::convert::TryInto/From
yield Result
while the built-in trait yields Option
from fraction.
I think there's no much we would gain from Result::Err
, but to conform with Rust APIs we'll go for Result<T, ()>
.
from fraction.
Actually, now I'm thinking, it could become Result<T, Self>
from fraction.
@dnsl48 That's better, I think!
from fraction.
I've had a go at it and unfortunately, that's not going to be feasible until we get specializations because of the core blanket trait implementations for TryFrom and TryInto.
error[E0119]: conflicting implementations of trait `std::convert::TryFrom<fraction::GenericFraction<_>>` for type `fraction::GenericFraction<_>`:
--> src/fraction/mod.rs:4400:9
|
4400 | / impl<T, F> TryFrom<GenericFraction<F>> for GenericFraction<T>
4401 | | where
4402 | | T: Copy + Integer + TryFrom<F>,
4403 | | F: Copy + Integer,
... |
4409 | | }
4410 | | }
| |_________^
|
= note: conflicting implementation in crate `core`:
- impl<T, U> std::convert::TryFrom<U> for T
where U: std::convert::Into<T>;
error: aborting due to previous error
For more information about this error, try `rustc --explain E0119`.
I guess an option for now is to replace the current convert custom internal implementation with the core try_from
for the built-in types. However, we still cannot get rid of TryToConvertFrom trait completely without specializations.
from fraction.
@dnsl48 That's a shame, better than nothing still!
Someday we'll get specialization... someday
from fraction.
Related Issues (20)
- Add better unicode support (Fraction slash/division slash) HOT 8
- eligible for funding via thanks.dev HOT 2
- Completing implemention of `identities` module from `num_traits` HOT 3
- Add support for ruint? HOT 1
- FromStr trait support + Parse fractions HOT 4
- How to convert to `f32` and `f64` numeric types HOT 1
- .pow() and .root() functions for fraction types HOT 3
- Serde support? HOT 2
- Fraction::from_str can fail with overflow if fractional part ends with too many zeroes HOT 3
- Weird huge values when getting the denominator of a fraction HOT 9
- Serialization support for DynaInt HOT 1
- Error: trait bounds other than `Sized` on const fn parameters are unstable HOT 2
- What does it mean that a value cannot be represented by `Ratio<T>`? HOT 2
- Fraction ceil and floor round negative fraction "the wrong way" HOT 1
- how do you conver a GenericFraction into a float? HOT 5
- Is there a list of methods that floats have that aren't impled for fractions HOT 2
- Do not simplify fractions HOT 1
- How should I handle consts? HOT 1
- Add From for f64 and f32 HOT 6
- Trait bounds were not satisfied with nalgebra HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fraction.