首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >有没有办法在rustdoc中嵌入序列图?

有没有办法在rustdoc中嵌入序列图?
EN

Stack Overflow用户
提问于 2020-10-14 15:14:38
回答 2查看 229关注 0票数 1

正如他们所说,一张图片抵得上1000个单词。我想在我生成的rust documentation中嵌入几个sequence diagrams。有没有办法做到这一点?拥有一个embedded image并不能真正起作用,它更难维护,它是文档之外的资产,等等。

EN

回答 2

Stack Overflow用户

发布于 2020-10-14 16:25:07

最通用的方法是在非代码块中使用基于文本的图表。

代码语言:javascript
复制
/// 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 {

}

将以如下方式呈现:

这是可接受的和/或实用的,这取决于你。

票数 3
EN

Stack Overflow用户

发布于 2020-10-14 15:38:19

你有没有看过https://docs.rs/crate/mdbook-plantuml/0.3.0

Plantuml是一个使用易于维护的文本来描述序列图的非常好的工具。以下是来自plantuml website的示例

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64348342

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档