Struct winsafe::guard::DestroyIconShfiGuard
source · pub struct DestroyIconShfiGuard { /* private fields */ }
Available on crate features
kernel
and shell
only.Expand description
RAII implementation for SHFILEINFO
which
automatically calls
DestroyIcon
on hIcon
field when the object goes out of scope.
Implementations§
source§impl DestroyIconShfiGuard
impl DestroyIconShfiGuard
sourcepub const unsafe fn new(shfi: SHFILEINFO) -> Self
pub const unsafe fn new(shfi: SHFILEINFO) -> Self
Constructs the guard by taking ownership of the struct.
§Safety
Be sure the handle must be freed with
DestroyIcon
at the end of scope.
sourcepub fn leak(&mut self) -> SHFILEINFO
pub fn leak(&mut self) -> SHFILEINFO
Ejects the underlying struct, leaving
SHFILEINFO::default
in its place.
Since the internal handle will be invalidated, the destructor will not run. It’s your responsibility to run it, otherwise you’ll cause a resource leak.
Methods from Deref<Target = SHFILEINFO>§
sourcepub fn szDisplayName(&self) -> String
pub fn szDisplayName(&self) -> String
Returns the string field.
sourcepub fn set_szDisplayName(&mut self, text: &str)
pub fn set_szDisplayName(&mut self, text: &str)
Sets the string field.
sourcepub fn szTypeName(&self) -> String
pub fn szTypeName(&self) -> String
Returns the string field.
sourcepub fn set_szTypeName(&mut self, text: &str)
pub fn set_szTypeName(&mut self, text: &str)
Sets the string field.
Trait Implementations§
source§impl Deref for DestroyIconShfiGuard
impl Deref for DestroyIconShfiGuard
source§impl DerefMut for DestroyIconShfiGuard
impl DerefMut for DestroyIconShfiGuard
Auto Trait Implementations§
impl RefUnwindSafe for DestroyIconShfiGuard
impl Send for DestroyIconShfiGuard
impl !Sync for DestroyIconShfiGuard
impl Unpin for DestroyIconShfiGuard
impl UnwindSafe for DestroyIconShfiGuard
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more