Skip to content

error[E0599]: no method named to_f32 found for struct euclid::Rect<Au, LayoutPixel> in the current scope #46

@kaiwk

Description

@kaiwk

I want to convert au_rect: Rect<Au, LayoutPixel> to f32_rect: Rect<f32, LayoutPixel> by au_rect.to_f32(), as the compiler prompts:

26 | pub struct Au(pub i32);
   | ----------------------- doesn't satisfy `Au: num_traits::cast::NumCast`
   |
   = note: the method `to_f32` exists but the following trait bounds were not satisfied:
           `Au: num_traits::cast::NumCast`

Can we just impl NumCast for Au?

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