Currently, syn is only necessary for the embed_doc_image attribute. Although the #[embed_doc_image] also works on older Rust versions, it seems like a reasonable trade-off to only be able to generate docs for Rust > 1.54. Then we can remove #[embed_doc_image] as well as syn. The remaining dependencies are hopefully lightweight enough that most users won't need to disable them during non-doc compilation.
We should also simplify documentation to focus on the case when Rust >= 1.54 - in which case using embed-doc-image is easy, and put less emphasis on all the workarounds for making code compile on Rust < 1.54 (although still discuss them).
Additionally, as suggested by @GuillaumeGomez here, we can use cfg(doc) to ensure that embed_image! evaluates to a no-op when not compiling docs.
Finally, we should also provide an enabled feature that, when not enabled, makes the whole crate a no-op with no dependencies. This way it's possible for users to only embed doc images when a feature, and otherwise pay no price whatsoever when the feature is not enabled.
Currently,
synis only necessary for theembed_doc_imageattribute. Although the#[embed_doc_image]also works on older Rust versions, it seems like a reasonable trade-off to only be able to generate docs for Rust > 1.54. Then we can remove#[embed_doc_image]as well assyn. The remaining dependencies are hopefully lightweight enough that most users won't need to disable them during non-doc compilation.We should also simplify documentation to focus on the case when Rust >= 1.54 - in which case using
embed-doc-imageis easy, and put less emphasis on all the workarounds for making code compile on Rust < 1.54 (although still discuss them).Additionally, as suggested by @GuillaumeGomez here, we can use
cfg(doc)to ensure thatembed_image!evaluates to a no-op when not compiling docs.Finally, we should also provide an
enabledfeature that, when not enabled, makes the whole crate a no-op with no dependencies. This way it's possible for users to only embed doc images when a feature, and otherwise pay no price whatsoever when the feature is not enabled.