Derive Macro glib_macros::SharedBoxed

source ·
    // Attributes available to this derive:
Expand description

Derive macro for defining a SharedType::get_type function and the glib::Value traits. Optionally, the type can be marked as nullable to get an implementation of glib::value::ToValueOptional.


use glib::prelude::*;
use glib::subclass::prelude::*;

#[derive(Clone, Debug, PartialEq, Eq)]
struct MySharedInner {
  foo: String,

#[derive(Clone, Debug, PartialEq, Eq, glib::SharedBoxed)]
#[shared_boxed_type(name = "MySharedBoxed")]
struct MySharedBoxed(std::sync::Arc<MySharedInner>);

#[derive(Clone, Debug, PartialEq, Eq, glib::SharedBoxed)]
#[shared_boxed_type(name = "MyNullableSharedBoxed", nullable)]
struct MyNullableSharedBoxed(std::sync::Arc<MySharedInner>);