glib_macros

Derive Macro Boxed

Source
#[derive(Boxed)]
{
    // Attributes available to this derive:
    #[boxed_type]
}
Expand description

Derive macro for defining a BoxedType::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, glib::Boxed)]
#[boxed_type(name = "MyBoxed")]
struct MyBoxed(String);

#[derive(Clone, Debug, PartialEq, Eq, glib::Boxed)]
#[boxed_type(name = "MyNullableBoxed", nullable)]
struct MyNullableBoxed(String);