正如他们所说,一张图片抵得上1000个单词。我想在我生成的rust documentation中嵌入几个sequence diagrams。有没有办法做到这一点?拥有一个embedded image并不能真正起作用,它更难维护,它是文档之外的资产,等等。
发布于 2020-10-14 16:25:07
最通用的方法是在非代码块中使用基于文本的图表。
/// 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 {
}将以如下方式呈现:

这是可接受的和/或实用的,这取决于你。
发布于 2020-10-14 15:38:19
你有没有看过https://docs.rs/crate/mdbook-plantuml/0.3.0
Plantuml是一个使用易于维护的文本来描述序列图的非常好的工具。以下是来自plantuml website的示例

https://stackoverflow.com/questions/64348342
复制相似问题