You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
Hmm, do you expect the target rect to be in actual pixels I guess? (as in, the equivalent to to_f32_px()?)
I think NumCast can be confusing, because you may want the Au value as f32 (so value.0 as f32 or such), or the actual pixel value as f32 (value.as_f32_px())
I think NumCast can be confusing, because you may want the Au value as f32 (so value.0 as f32 or such), or the actual pixel value as f32 (value.as_f32_px())
Out of curiosity, when is it useful to have value.0 as f32?
I want to convert
au_rect: Rect<Au, LayoutPixel>
tof32_rect: Rect<f32, LayoutPixel>
byau_rect.to_f32()
, as the compiler prompts:Can we just impl
NumCast
forAu
?The text was updated successfully, but these errors were encountered: