phil-opp / blog_os

Writing an OS in Rust
http://os.phil-opp.com
Apache License 2.0
14.27k stars 1.01k forks source link

Update edition3/03/index.md #1272

Open xuanplus opened 5 months ago

xuanplus commented 5 months ago

enable it to print "Hello Rust!" on qemu:

屏幕截图(1)

I find that I can't use runtime values inside the pattern, I can only match on a range made of compile-time constants.

Therefore, I add the function in_range to judge it.

The Point from embedded_graphics can't use try_into? So I add a From to change it to Position.

The impl OriginDimensions is from example of embedded_graphics official:

This trait should be implemented instead of Dimensions if the top left corner of the bounding box will always be at the origin, which will be the case for most display drivers. Some types, like [ImageDrawable], require a bounding box that starts at the origin and can only be used if OriginDimensions is implemented.

Anyway, now, It works.

phil-opp commented 4 months ago

Thanks for submitting this! I will probably not merge this directly, but I will definitely consider it when I write the rest of this post.