Add Export feature on dynamic_map macro
I would like to be able to hook a custom function from "imageops" crate. I would like to recreate a function similar to the following example of 'blur':
pub fn blur(&self, sigma: f32) -> DynamicImage { dynamic_map!(*self, ref p => imageops::blur(p, sigma)) }
As you can see with the enabling of the export of the macro 'dynamic_map' i can add new functionalities from the 'imageops' crate (i.e.: overlay()).
There's a small detail easily missed: DynamicImage is non_exhaustive. The macro does not create any fallback match arm. It would thus not work in its current state outside the crate where such a match arm is required by the compiler.
Right. You are right; but if the macro would be exhaustive it could be easily "plugged" any apis of the imageops crate. What do you think?
Ottenere Outlook per Androidhttps://aka.ms/AAb9ysg
From: HeroicKatora @.> Sent: Tuesday, October 18, 2022 1:21:54 PM To: image-rs/image @.> Cc: c4r3 @.>; Author @.> Subject: Re: [image-rs/image] Add Export feature on dynamic_map macro (Issue #1809)
There's a small detail easily missed: DynamicImage is non_exhaustive. The macro does not create any fallback match arm. It would thus not work in its current state outside the crate where such a match arm is required by the compiler.
— Reply to this email directly, view it on GitHubhttps://github.com/image-rs/image/issues/1809#issuecomment-1282227747, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC5DVTTFQ2FPC32IJ46JKX3WD2B5FANCNFSM6AAAAAARHBGXGA. You are receiving this because you authored the thread.Message ID: @.***>
That interface has no form of SemVer compatibility. There's no describably type interface and minute changes to the internal types will break upstream dependencies. It would completely subvert the extensibility for which DynamicImage is non-exhaustive in the first place. I wouldn't want to expose such an interface.
Ok I got it, you are right. The capability of "plug" different custom functions thank to the abstraction of the DynamicImage would be a comfortable feature, but never mind.
Ottenere Outlook per Androidhttps://aka.ms/AAb9ysg
From: HeroicKatora @.> Sent: Tuesday, October 18, 2022 5:07:41 PM To: image-rs/image @.> Cc: c4r3 @.>; Author @.> Subject: Re: [image-rs/image] Add Export feature on dynamic_map macro (Issue #1809)
That interface has no form of SemVer compatibility. There's no describably type interface and minute changes to the internal types will break upstream dependencies. It would completely subvert the extensibility for which DynamicImage is non-exhaustive in the first place. I wouldn't want to expose such an interface.
— Reply to this email directly, view it on GitHubhttps://github.com/image-rs/image/issues/1809#issuecomment-1282548244, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC5DVTW2TLS4UZMGOFYACHDWD24L3ANCNFSM6AAAAAARHBGXGA. You are receiving this because you authored the thread.Message ID: @.***>
If anyone comes up with a good SemVer story for such a macro, we can definitely do it though! The need for abstraction and comfort are definitely there.