Previously was in function:
let lpPaintStruct: LPPAINTSTRUCT =
libc::malloc(mem::size_of::<PAINTSTRUCT>() as libc::size_t) as *mut PAINTSTRUCT;
this was disadvantages:
- need malloc whereas it can be on stack
- need free otherwise memory leak
- need unsafe
I try:
let mut PaintStruct: PAINTSTRUCT;
and let mut lpPaintStruct: LPPAINTSTRUCT = &PaintStruct;
or let mut lpPaintStruct: *mut PAINTSTRUCT = &PaintStruct;
I have error:
mismatched types [E0308]:
expected type *mut winapi::PAINTSTRUCT
found type &winapi::PAINTSTRUCT
types differ in mutability