Skip to content

Commit efc51cd

Browse files
committed
macros: generate GlibPtrDefault when deriving Boxed and SharedBoxed
1 parent 0409821 commit efc51cd

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

glib-macros/src/boxed_derive.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ pub fn impl_boxed(input: &syn::DeriveInput) -> TokenStream {
197197

198198
#impl_from_value
199199

200+
impl #crate_ident::translate::GlibPtrDefault for #name {
201+
type GlibType = *mut #name;
202+
}
203+
200204
impl #crate_ident::translate::FromGlibPtrBorrow<*const #name> for #name {
201205
#[inline]
202206
unsafe fn from_glib_borrow(ptr: *const #name) -> #crate_ident::translate::Borrowed<Self> {

glib-macros/src/shared_boxed_derive.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,10 @@ pub fn impl_shared_boxed(input: &syn::DeriveInput) -> proc_macro2::TokenStream {
218218

219219
#impl_from_value
220220

221+
impl #crate_ident::translate::GlibPtrDefault for #name {
222+
type GlibType = *mut #refcounted_type_prefix::InnerType;
223+
}
224+
221225
impl #crate_ident::translate::FromGlibPtrBorrow<*const #refcounted_type_prefix::InnerType> for #name {
222226
#[inline]
223227
unsafe fn from_glib_borrow(ptr: *const #refcounted_type_prefix::InnerType) -> #crate_ident::translate::Borrowed<Self> {

0 commit comments

Comments
 (0)