Cargo question: Can an executable example have its own library?
Examples don't have their own Cargo.toml file, unlike targets. So there's no obvious way to express this in Cargo.toml form.
Use case: I'm working on a GUI library. The library itself has the general-purpose part. The example uses it, and the example also needs a library of all the dialogs specific to the example. This separates the UI from the parts that do the work, so people can work on the menus separately from the rest of the system.
Some projects use a workspace to hold multiple crates, for example the ash project (a Vulkan implementation in Rust). The example is a crate itself, not an "examples" folder in src.
That's pretty much what I did. In the real application, they become a library. This is just for my ui-mock demo of my libui library. For a real application, the examples folder is not used, and you have to provide a dialogs folder of your own.