Crates.io | rust2uml |
lib.rs | rust2uml |
version | 0.0.2 |
source | src |
created_at | 2023-12-12 12:17:40.310817 |
updated_at | 2023-12-12 12:38:02.463542 |
description | A library to generating UML language from Rust's project into graphiz/dot file. |
homepage | https://github.com/silence-coding/ml |
repository | https://github.com/silence-coding/ml |
max_upload_size | |
id | 1066315 |
size | 124,221 |
A library (and cli tool) to generating UML language from Rust's project into graphiz/dot file.
$ git clone https://github.com/silence-coding/ml.git
$ cd ml
The dot
binary from graphviz package must exist in your path.
$ apt install graphviz
(or do the equivalent for your OS)
Nightly rustc is required. Run this from within ml crate.
$ rustup install rustc llvm-tools-preview
$ cargo run --example ml
important: ml looks for files beneath ./src, so you should always cd to crate root before running it.
$ firefox target/doc/ml.svg
inkscape
also works well as an svg viewer.
$ ./target/debug/examples/ml --help Usage: ml [OPTIONS]
Parses rust source code and generates UML diagram
Arguments:
--include_fields [bool] include fields/variants in diagram
--include_implems [bool] include trait implementation methods in diagram
--include_methods [bool] include methods in diagram
--struct_header_bgcolor [str] header background color for structs
--struct_fields_bgcolor [str] fields background color for structs
--struct_method_bgcolor [str] methods background color for structs
--struct_implem_bgcolor [str] implems background color for structs
--enum_header_bgcolor [str] header background color for enums
--enum_fields_bgcolor [str] fields background color for enums
--enum_method_bgcolor [str] methods background color for enums
--enum_implem_bgcolor [str] implems background color for enums
--trait_header_bgcolor [str] header background color for traits
--trait_method_bgcolor [str] methods background color for traits
--font [str] Font name
Output is always under target/doc/mml/
You can add ml
binary to your path and then you should be able to run
it for any rust crate.
--------------------------- Old, possibly obsolete -----------------
This repo is provided as a Cargo package and a build script.
Cargo.toml
to include.build = "build.rs"
[build-dependencies.rust2uml]
version = "0.0.1"
build.rs
to generate your uml graph/viz and Structured Vector Graphics at target/dot/$CARGO_PKG_NAME.{dot,svg}
.extern crate mml;
fn main() {
let dest: String = concat!("target/doc/", env!("CARGO_PKG_NAME")).to_string();
let mut config = rust2uml::Config::default();
rust2uml::Config::set_global(config);
let _ = rust2uml::src2both("src", dest.replace("-", "_").as_str());
}
//! ![uml](ml.svg)
addons:
apt:
packages:
- graphviz
before_script:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install graphviz ; fi
...
script:
- |
travis-cargo build &&
...
Consider this list of fonctionalities like unstandard-uml.
This is a reading list of material relevant to Ml. It includes prior research that has - at one time or another - influenced the design of Ml, as well as publications about Ml.
ml
is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.
See LICENSE-APACHE, and LICENSE-MIT for details.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.