Skip to content

InformationRate * Time = Information != Ratio #189

@exastion

Description

@exastion

I'm pretty new to this library, but I think I found a bug concerning multiplication of different quantities.
Multiplying InformationRate and Time should result in Information, at least I would assume this and as far as I can see from the example, this type of multiplication should be possible.
Here a MVE that illustrates the problem:

use uom::si::f32::*;
use uom::si::information_rate::byte_per_second;
use uom::si::time::second;
use uom::si::information::byte;

fn main() {
    let r = InformationRate::new::<byte_per_second>(10.0);
    let t = Time::new::<second>(1.0);
    let b = r * t;
    let _ = b.get::<byte>();
}

According to the compiler error, it produces a ratio:

❯ cargo build    
   Compiling mve v0.1.0 (/home/sven/Documents/mve)
error[E0277]: the trait bound `uom::si::information::byte: uom::si::ratio::Unit` is not satisfied
  --> src/main.rs:11:15
   |
11 |     let _ = b.get::<byte>();
   |               ^^^ the trait `uom::si::ratio::Unit` is not implemented for `uom::si::information::byte`

error: aborting due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions