#[macro_export]
macro_rules! wrapper {
(
$(#[$attr:meta])*
$visibility:vis struct $name:ident $(<$($generic:ident $(: $bound:tt $(+ $bound2:tt)*)?),+>)? (Boxed<$ffi_name:ty>);
match fn {
copy => |$copy_arg:ident| $copy_expr:expr,
free => |$free_arg:ident| $free_expr:expr,
$(
type_ => || $get_type_expr:expr,
)?
}
) => {
$crate::glib_boxed_wrapper!(
[$($attr)*] $visibility $name $(<$($generic $(: $bound $(+ $bound2)*)?),+>)?, $ffi_name,
@copy $copy_arg $copy_expr, @free $free_arg $free_expr
$(, @type_ $get_type_expr)?
);
};
(
$(#[$attr:meta])*
$visibility:vis struct $name:ident $(<$($generic:ident $(: $bound:tt $(+ $bound2:tt)*)?),+>)? (BoxedInline<$ffi_name:ty>);
match fn {
$(
copy => |$copy_arg:ident| $copy_expr:expr,
free => |$free_arg:ident| $free_expr:expr,
)?
$(
init => |$init_arg:ident| $init_expr:expr,
copy_into => |$copy_into_arg_dest:ident, $copy_into_arg_src:ident| $copy_into_expr:expr,
clear => |$clear_arg:ident| $clear_expr:expr,
)?
$(
type_ => || $get_type_expr:expr,
)?
}
) => {
$crate::glib_boxed_inline_wrapper!(
[$($attr)*] $visibility $name $(<$($generic $(: $bound $(+ $bound2)*)?),+>)?, $ffi_name
$(, @copy $copy_arg $copy_expr, @free $free_arg $free_expr)?
$(, @init $init_arg $init_expr, @copy_into $copy_into_arg_dest $copy_into_arg_src $copy_into_expr, @clear $clear_arg $clear_expr)?
$(, @type_ $get_type_expr)?
);
};
(
$(#[$attr:meta])*
$visibility:vis struct $name:ident $(<$($generic:ident $(: $bound:tt $(+ $bound2:tt)*)?),+>)? (BoxedInline<$ffi_name:ty>);
) => {
$crate::glib_boxed_inline_wrapper!(
[$($attr)*] $visibility $name $(<$($generic $(: $bound $(+ $bound2)*)?),+>)?, $ffi_name
);
};
(
$(#[$attr:meta])*
$visibility:vis struct $name:ident $(<$($generic:ident $(: $bound:tt $(+ $bound2:tt)*)?),+>)? (Shared<$ffi_name:ty>);
match fn {
ref => |$ref_arg:ident| $ref_expr:expr,
unref => |$unref_arg:ident| $unref_expr:expr,
$(
type_ => || $get_type_expr:expr,
)?
}
) => {
$crate::glib_shared_wrapper!(
[$($attr)*] $visibility $name $(<$($generic $(: $bound $(+ $bound2)*)?),+>)?, $ffi_name,
@ref $ref_arg $ref_expr, @unref $unref_arg $unref_expr
$(, @type_ $get_type_expr)?
);
};
(
$(#[$attr:meta])*
$visibility:vis struct $name:ident $(<$($generic:ident $(: $bound:tt $(+ $bound2:tt)*)?),+>)? (Object<$ffi_name:ty $(, $ffi_class_name:ty)?>) $(@implements $($implements:path),+)?;
match fn {
type_ => || $get_type_expr:expr,
}
) => {
$crate::glib_object_wrapper!(
@object [$($attr)*] $visibility $name $(<$($generic $(: $bound $(+ $bound2)*)?),+>)?, *mut std::os::raw::c_void, (), $ffi_name,
$( @ffi_class $ffi_class_name ,)?
@type_ $get_type_expr,
@extends [],
@implements [$($($implements),+)?]
);
};
(
$(#[$attr:meta])*
$visibility:vis struct $name:ident $(<$($generic:ident $(: $bound:tt $(+ $bound2:tt)*)?),+>)? (Object<$ffi_name:ty $(, $ffi_class_name:ty)?>) @extends $($extends:path),+ $(, @implements $($implements:path),+)?;
match fn {
type_ => || $get_type_expr:expr,
}
) => {
$crate::glib_object_wrapper!(
@object [$($attr)*] $visibility $name $(<$($generic $(: $bound $(+ $bound2)*)?),+>)?, *mut std::os::raw::c_void, (), $ffi_name,
$( @ffi_class $ffi_class_name ,)?
@type_ $get_type_expr,
@extends [$($extends),+],
@implements [$($($implements),+)?]
);
};
(
$(#[$attr:meta])*
$visibility:vis struct $name:ident $(<$($generic:ident $(: $bound:tt $(+ $bound2:tt)*)?),+>)? (ObjectSubclass<$subclass:ty>) $(@implements $($implements:path),+)?;
) => {
$crate::glib_object_wrapper!(
@object_subclass [$($attr)*] $visibility $name $(<$($generic $(: $bound $(+ $bound2)*)?),+>)?, $subclass,
@extends [],
@implements [$($($implements),+)?]
);
};
(
$(#[$attr:meta])*
$visibility:vis struct $name:ident $(<$($generic:ident $(: $bound:tt $(+ $bound2:tt)*)?),+>)? (ObjectSubclass<$subclass:ty>) @extends $($extends:path),+ $(, @implements $($implements:path),+)?;
) => {
$crate::glib_object_wrapper!(
@object_subclass [$($attr)*] $visibility $name $(<$($generic $(: $bound $(+ $bound2)*)?),+>)?, $subclass,
@extends [$($extends),+],
@implements [$($($implements),+)?]
);
};
(
$(#[$attr:meta])*
$visibility:vis struct $name:ident $(<$($generic:ident $(: $bound:tt $(+ $bound2:tt)*)?),+>)? (Interface<$ffi_name:ty $(, $ffi_class_name:ty)?>) $(@requires $($requires:path),+)?;
match fn {
type_ => || $get_type_expr:expr,
}
) => {
$crate::glib_object_wrapper!(
@interface [$($attr)*] $visibility $name $(<$($generic $(: $bound $(+ $bound2)*)?),+>)?, *mut std::os::raw::c_void, $ffi_name,
$( @ffi_class $ffi_class_name ,)?
@type_ $get_type_expr,
@requires [$( $($requires),+ )?]
);
};
(
$(#[$attr:meta])*
$visibility:vis struct $name:ident $(<$($generic:ident $(: $bound:tt $(+ $bound2:tt)*)?),+>)? (ObjectInterface<$iface_name:ty>) $(@requires $($requires:path),+)?;
) => {
$crate::glib_object_wrapper!(
@interface [$($attr)*] $visibility $name $(<$($generic $(: $bound $(+ $bound2)*)?),+>)?, *mut std::os::raw::c_void, std::os::raw::c_void,
@ffi_class $iface_name,
@type_ $crate::translate::IntoGlib::into_glib(<$iface_name as $crate::subclass::interface::ObjectInterfaceType>::type_()),
@requires [$( $($requires),+ )?]
);
};
}