Giter Site home page Giter Site logo

Comments (2)

iliekturtles avatar iliekturtles commented on August 17, 2024

I don't think the trait is necessary. Similar to how how methods for other underlying types are implemented, we would just need to add methods for Complex to return the re/im fields.

e.g. is_nan for floating point types:

uom/src/system.rs

Lines 759 to 780 in 85b665e

// Explicitly definte floating point methods for float and complex storage types.
// `Complex<T>` doesn't implement `Float`/`FloatCore`, but it does implement these methods
// when the underlying type, `T`, implements `FloatCore`.
mod float {
storage_types! {
types: Float, Complex;
use super::super::*;
impl<D, U> Quantity<D, U, V>
where
D: Dimension + ?Sized,
U: Units<V> + ?Sized,
{
/// Returns `true` if this value is `NAN` and `false` otherwise.
#[cfg_attr(feature = "cargo-clippy", allow(clippy::wrong_self_convention))]
#[must_use = "method returns a new number and does not mutate the original value"]
#[inline(always)]
pub fn is_nan(self) -> bool
{
self.value.is_nan()
}

from uom.

mkalte666 avatar mkalte666 commented on August 17, 2024

oh sorry I should have clarified this; im using the trait because I don't wanna keep track of(rather, don't have the time for) more patching right now. Basically a quick and dirty way to get this to work for me right now without much thought^^

A solution like you described would be much preferable :D

Maybe I can get to that as well later, but right now I'm quite busy in way to may ways ;_;

from uom.

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.