diff --git a/gegl/Cargo.toml b/gegl/Cargo.toml index c5a02a8..e110cc8 100644 --- a/gegl/Cargo.toml +++ b/gegl/Cargo.toml @@ -18,6 +18,7 @@ workspace = true [dependencies] indexmap = "2.1.0" +paste = "1.0.14" [dev-dependencies] insta = "1.34.0" diff --git a/gegl/source/operations/macros.rs b/gegl/source/operations/macros.rs index c2b79ba..9072b7d 100644 --- a/gegl/source/operations/macros.rs +++ b/gegl/source/operations/macros.rs @@ -23,6 +23,23 @@ macro_rules! gegl_operation { )* } + paste::paste! { + impl $struct_name { + $( + #[doc = concat!(" Builder function to assign `", stringify!($key), "`.")] + pub fn [](mut self, value: $key_type) -> $struct_name { + self.$key = value; + self + } + )* + + /// Get this operation inside a [`Box`]. + pub fn boxed(self) -> Box<$struct_name> { + Box::new(self) + } + } + } + impl Default for $struct_name { fn default() -> $struct_name { $struct_name {