百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
L

layout

> 编程语言
开源

Layout 是一个 Rust 库,也是一个用于渲染 Graphviz dot 文件的工具。

740 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

Layout 是一个 Rust 库,也是一个用于渲染 Graphviz dot 文件的工具。

Layout

Layout is a rust library and a stand alone utility that draws graphs. Layout can parse Graphviz dot files and render them.

Latest Version Docs Badge

Library Usage

Add the following to Cargo.toml:

toml
layout-rs = "0.1.2" # or
layout-rs = { version = "0.1.2", features = ["log"] }

Load, parse and print the AST:

rust
use layout::gv;

let contents = "digraph { a -> b [label=\"foo\"]; }";
let mut parser = gv::DotParser::new(&contents);

match parser.process() {
    Ok(g) => gv::dump_ast(&g),
    Err(err) => {
        parser.print_error();
        # #[cfg(feature = "log")]
        log::error!("Error: {}", err);
    }
}

The example above would print the program AST, or a readable error message, such as:

txt
digraph {

node [fillcolor="purple"] A B;
node [fillcolor="orange"] Z;
node [fillcolor="green"] G; a = ;
                                ^
Error: Expected an identifier.

Command Line Usage

Build the crate and render some dot files with the command

bash
cargo run --bin layout ./inputs/bk.dot -o output.svg

Gallery

This section presents a few graphs that were rendered from dot files:

A simple graph.

A simple graph with multiple shapes and labels.

A graph with a few style properties.

A large graph that demonstrates the edge crossing elimination optimization.

Unicode, emoji and right-to-left languages:

Support for Records (nested structures):

Debug-mode rendering that helps to visualize the layout decisions:

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustgraphviz

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言