| 1 |
glib::wrapper! { |
| 2 |
#[doc(alias = "GInitiallyUnowned")] |
| 3 |
pub struct InitiallyUnowned(Object<glib::gobject_ffi::GInitiallyUnowned, glib::gobject_ffi::GInitiallyUnownedClass>); |
| 4 |
|
| 5 |
match fn { |
| 6 |
type_ => || glib::gobject_ffi::g_initially_unowned_get_type(), |
| 7 |
} |
| 8 |
} |
| 9 |
|
| 10 |
pub trait InitiallyUnownedImpl: |
| 11 |
glib::subclass::prelude::ObjectImpl |
| 12 |
+ glib::subclass::prelude::ObjectSubclass<Type: glib::prelude::IsA<InitiallyUnowned>> |
| 13 |
{ |
| 14 |
} |
| 15 |
|
| 16 |
unsafe impl<T: InitiallyUnownedImpl> glib::subclass::prelude::IsSubclassable<T> |
| 17 |
for InitiallyUnowned |
| 18 |
{ |
| 19 |
} |
| 20 |
|
| 21 |
mod imp_object { |
| 22 |
use glib::subclass::prelude::*; |
| 23 |
|
| 24 |
#[derive(Default)] |
| 25 |
pub struct TestObject { |
| 26 |
s: String, |
| 27 |
} |
| 28 |
|
| 29 |
#[glib::object_subclass] |
| 30 |
impl ObjectSubclass for TestObject { |
| 31 |
const NAME: &'static str = "TestObject"; |
| 32 |
type Type = super::TestObject; |
| 33 |
type ParentType = super::InitiallyUnowned; |
| 34 |
} |
| 35 |
|
| 36 |
impl ObjectImpl for TestObject {} |
| 37 |
impl super::InitiallyUnownedImpl for TestObject {} |
| 38 |
} |
| 39 |
|
| 40 |
glib::wrapper! { |
| 41 |
pub struct TestObject(ObjectSubclass<imp_object::TestObject>) @extends InitiallyUnowned; |
| 42 |
} |
| 43 |
|
| 44 |
impl Default for TestObject { |
| 45 |
fn default() -> Self { |
| 46 |
glib::Object::new() |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
fn main() { |
| 51 |
fn check<T: Send + Sync>(_obj: &T) {} |
| 52 |
|
| 53 |
let obj = TestObject::default(); |
| 54 |
check(&obj); |
| 55 |
} |