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
My colleague was trying this chapter and found it difficult to solve the exercise, claiming that looking at the hints was "a mistake". Instead, after messing around with casting he ended up solving it by using write!(f, "RGB ({red}, {green}, {blue}) 0x{red:02X}{green:02X}{blue:02X}").
I propose changing this hint to not need casts or explicitly telling the reader how they can cast between u8 and u32 values while referring them to the future chapter.
The text was updated successfully, but these errors were encountered:
In chapter 1.2.3 Formatting, one of the exercises given to the users is to implement the Display trait for a color struct to print the hex code.
One of the hints given says "The formula for calculating a color in the RGB color space is:
RGB = (R*65536)+(G*256)+B , (when R is RED, G is GREEN and B is BLUE)
". I don't think this is a very good hint, as it requires casting the RGB values from u8 to u32 which is a topic that is only covered in chapter 5.My colleague was trying this chapter and found it difficult to solve the exercise, claiming that looking at the hints was "a mistake". Instead, after messing around with casting he ended up solving it by using
write!(f, "RGB ({red}, {green}, {blue}) 0x{red:02X}{green:02X}{blue:02X}")
.I propose changing this hint to not need casts or explicitly telling the reader how they can cast between u8 and u32 values while referring them to the future chapter.
The text was updated successfully, but these errors were encountered: