We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
IntoGlibPtr
Option<T>
1 parent 419f13f commit 3cc1064Copy full SHA for 3cc1064
glib/src/translate.rs
@@ -579,6 +579,15 @@ pub trait IntoGlibPtr<P: Ptr> {
579
unsafe fn into_glib_ptr(self) -> P;
580
}
581
582
+impl<P: Ptr, T: IntoGlibPtr<P>> IntoGlibPtr<P> for Option<T> {
583
+ #[inline]
584
+ unsafe fn into_glib_ptr(self) -> P {
585
+ self.map_or(Ptr::from::<()>(ptr::null_mut()), |s| {
586
+ IntoGlibPtr::into_glib_ptr(s)
587
+ })
588
+ }
589
+}
590
+
591
impl GlibPtrDefault for str {
592
type GlibType = *mut c_char;
593
0 commit comments