Comment by piker
4 days ago
These are all great points, and I will update the blog post to reflect them in the morning.
I believe this approach can work while retaining the most apparently-idiomatic mapping. What do you guys think?
impl IRibbonExtensibility_Impl for Addin_Impl {
unsafe fn GetCustomUI(&self, _ribbon_id: BSTR, out: *mut BSTR) -> HRESULT {
log("GetCustomUI called()");
std::mem::forget(_ribbon_id);
if out.is_null() {
return windows::Win32::Foundation::E_POINTER;
}
unsafe {
std::ptr::write(out, BSTR::from(RIBBON_XML));
}
S_OK
}
}
Looks fine to me, if you're avoiding wrappers like ManuallyDrop/MaybeUninit.
Actually the `windows-rs` team weighed in:
impl IRibbonExtensibility_Impl for Addin_Impl {
}
https://github.com/microsoft/windows-rs/issues/3832
Thanks for pushing on the issue! I've updated the blog post for GetCustomUI.