As they say, one picture is worth 1000 words. I'd like to embed several sequence diagrams
in my generated rust documentation
. Is there a way to do this? Having an embedded image
doesn't really work, it is harder to maintain, it is an asset outside of the docs, etc.
The most universal method would just be a text-based diagram in a non-code code block.
/// This module contains structs and functions for communicating to and from
/// the server. It is very important that you understand this diagram so you
/// will appreciate how much work has gone into this. Just look at it! Its
/// beautiful!
///
/// ```none
/// +------------+ +------------+
/// | Client | | Server |
/// +------------+ +------------+
/// | |
/// | request("/") |
/// +----------------------> |
/// | |
/// | response() |
/// | <----------------------+
/// | |
/// | |
/// v v
/// ```
///
/// Appreciating the diagram will give you a +1 to confidence for the rest of
/// the day.
pub mod connection {
}
Will end up rendering like this:
Its up to you whether this acceptable and/or practical.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With