How to react on window resize?

I’m learning both rust and piston at the same time. I made my app (a prototype), and it works, but there are few strange behaviors I can’t explain.

My code is here:

The problem with my current code is that resize misbehave terribly.

If window is scaled down, pixels become HUGE. It looks like texture is scaled up at the speed of window been scaled down.
If window scaled up (made bigger), I see black box around my draw area, even if I recreate both image buffer and texture with new sizes.

I can’t find any high-level docs on how it works (texture/buffer/transformations), so I made this by trial and error, but now I’m stuck. My texture is recreated on resize, my image is recreated, but window is ignoring(?) it.

Oh, I found it!
I need to add window.event(&e); at the end of event loop!

Sadly, it’s not in examples (I started from