Add builder functions to GeglOperations to more easily construct them.
This commit is contained in:
parent
190527d761
commit
5fb4ed793c
|
@ -18,6 +18,7 @@ workspace = true
|
|||
|
||||
[dependencies]
|
||||
indexmap = "2.1.0"
|
||||
paste = "1.0.14"
|
||||
|
||||
[dev-dependencies]
|
||||
insta = "1.34.0"
|
||||
|
|
|
@ -23,6 +23,23 @@ macro_rules! gegl_operation {
|
|||
)*
|
||||
}
|
||||
|
||||
paste::paste! {
|
||||
impl $struct_name {
|
||||
$(
|
||||
#[doc = concat!(" Builder function to assign `", stringify!($key), "`.")]
|
||||
pub fn [<with_ $key>](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 {
|
||||
|
|
Loading…
Reference in New Issue