abey79 / vsvg

Fast and portable tools for plotter users
http://whisk.rs
MIT License
107 stars 12 forks source link

Split whiskers widgets in their own `whiskers-widgets` crate #108

Closed abey79 closed 8 months ago

abey79 commented 8 months ago

The PR makes it possible for vsvg to use the Widget derive macro on its own types.

So far, the Widget trait for some vsvg types (such as Point, Unit, Length, etc.) was implemented within the whiskers crate. This is ok for manual implementation, but this would make it impossible to use the Widget derive macro because that would cause a circular dependency between the whiskers and vsvg crate.

This PR addresses this issue by splitting all widget traits and code into a separate whiskers-widgets crate, on which both whiskers and, optionally, vsvg depend. This is gated behind the whiskers-widgets feature of vsvg.

This PR also:

This is the resulting dependency graph:

flowchart LR
    UserSketch["User Sketch"]
    widgets["whiskers-widgets"]
    derive["whiskers-derive"]
    other["Custom Crate"]

    UserSketch --> whiskers
    UserSketch --> other
    other --> widgets
    whiskers --> vsvg
    whiskers --> widgets
    vsvg --> widgets
    widgets  --> derive

Note that whiskers reexport everything needed in whiskers::prelude::* so no other dependency/use statement is typically needed for user sketches.

TODO: