Giter Club home page Giter Club logo

Comments (3)

mcasper avatar mcasper commented on May 21, 2024

These look to be the PRs that added support for i64 conversion and f64 conversion respectively:
https://github.com/rust-lang/rust/pull/28921/files
https://github.com/rust-lang/rust/pull/29129/files

from diesel.

mcasper avatar mcasper commented on May 21, 2024

@sgrif How do we get around the orphan rule here? Implementing From<i32> for i64 or f64 produces

src/expression/extensions/interval_dsl.rs:112:1: 116:2 error: the impl does not reference any types defined in this crate; only traits defined in the current crate can be implemented for arbitrary types [E0117]
src/expression/extensions/interval_dsl.rs:112 impl From<i32> for i64 {
src/expression/extensions/interval_dsl.rs:113     fn from(small: i32) -> i64 {
src/expression/extensions/interval_dsl.rs:114         small as i64
src/expression/extensions/interval_dsl.rs:115     }
src/expression/extensions/interval_dsl.rs:116 }

Sorry if this is a super noob question, I've still got my Rust training wheels on

from diesel.

sgrif avatar sgrif commented on May 21, 2024

We shouldn't implement From<i32> for them, we should stop relying on it. I think the easiest thing to do is add fn times(self, x: i32) -> Self; to the trait, and use that instead of the * operator.

from diesel.

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.