Skip to content

Issue with float-types (trait bound Eq is not satisfied) #194

@cheliosooo

Description

@cheliosooo

I tried generating a rust client for Marginfii's idl found here

Various variables across the idl use the f64 type.

I generate a rust visitor:

const idlDir = path.join(__dirname, "idl");

const kinobi = k.createFromIdls([path.join(idlDir, "idl.json")]);

kinobi.update(
  k.updateProgramsVisitor({
    idl: { name: "idl" },
  })
);

kinobi.accept(
  new k.renderRustVisitor(
    path.join(__dirname, "programs", "sdk", "src", "generated")
  )
);

When I dive into the generated code, I have the following issue with the f64 type inside of generated/types/liquidation_balances.rs

the trait bound `f64: std::cmp::Eq` is not satisfied
the following other types implement trait `std::cmp::Eq`:
  isize
  i8
  i16
  i32
  i64
  i128
  usize
  u8

liquidation_balances.rs(11, 58): Error originated from macro call here
cmp.rs(339, 31): required by a bound in `AssertParamIsEq`

Is there a way to fix this with how I generate the rust visitor?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions