Derive Macro glib::SharedBoxed

source ·
#[derive(SharedBoxed)]
{
    // Attributes available to this derive:
    #[shared_boxed_type]
}
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.

§Example

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>);