MCPcopy Index your code
hub / github.com/anixe/doku

github.com/anixe/doku @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
596 symbols 1,240 edges 270 files 29 documented · 5%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Doku   crates-badge docs-badge

Doku is a framework for documenting Rust data structures - it allows to generate aesthetic, human-friendly descriptions of configuration types, requests / responses, and so on.

Say goodbye to stale, hand-written documentation - with Doku, code is the documentation!

Example

[dependencies]
doku = "0.21"
use doku::Document;
use serde::Deserialize;

#[derive(Deserialize, Document)]
struct Config {
    /// Database's engine
    db_engine: DbEngine,

    /// Database's host
    #[doku(example = "localhost")]
    db_host: String,

    /// Database's port
    #[doku(example = "5432")]
    db_port: usize,
}

#[derive(Deserialize, Document)]
enum DbEngine {
    #[serde(rename = "pgsql")]
    PostgreSQL,

    #[serde(rename = "mysql")]
    MySQL,
}

fn main() {
    println!("```json");
    println!("{}", doku::to_json::<Config>());
    println!("```");
    println!();
    println!("```toml");
    println!("{}", doku::to_toml::<Config>());
    println!("```");
}
{
  // Database's engine
  "db_engine": "pgsql" | "mysql",
  // Database's host
  "db_host": "localhost",
  // Database's port
  "db_port": 5432
}
# Database's engine
db_engine = "pgsql" | "mysql"

# Database's host
db_host = "localhost"

# Database's port
db_port = 5432

You'll find more examples in ./doku/examples; there's also a documentation at https://docs.rs/doku/.

Contributing

Found a bug, have an idea? Please let us know on GitHub - patches are welcome, too!

If you want to try hacking on Doku, the entry points are:

There are also integration tests at ./doku/tests.

License

Licensed under the MIT license.

Extension points exported contracts — how you extend this code

Document (Interface)
A type that can be pretty-printed by Doku. Usually you'll get this by adding `#[derive(Document)]` to your type: ``` u [2 …
doku/src/objects/document.rs
Trait (Interface)
(no doc)
doku/tests/printers/struct/with_generics_and_trait/mod.rs
Table (Interface)
(no doc) [4 implementers]
doku/src/printers/toml/table.rs
Output (Interface)
(no doc)
doku/src/printers/common/output.rs

Core symbols most depended-on inside this repo

iter
called by 61
doku/src/objects/meta.rs
write
called by 52
doku/src/printers/json/output.rs
write
called by 32
doku/src/printers/toml/output.rs
ln
called by 24
doku/src/printers/toml/output.rs
from_ast
called by 20
doku-derive/src/attrs.rs
is_table
called by 18
doku/src/printers/toml/table.rs
len
called by 18
doku/src/printers/common/output.rs
ln
called by 17
doku/src/printers/json/output.rs

Shape

Method 266
Class 158
Function 88
Enum 80
Interface 4

Languages

Rust100%

Modules by API surface

doku/src/objects/value/serializer.rs44 symbols
doku/src/printers/toml/output.rs20 symbols
doku/src/printers/toml/ctxt.rs19 symbols
doku/src/printers/json/output.rs15 symbols
doku/src/printers/json/ctxt.rs13 symbols
doku/src/objects/type.rs11 symbols
doku/src/objects/meta.rs9 symbols
doku/src/printers/toml.rs8 symbols
doku/src/printers/json.rs8 symbols
doku/src/printers/common/output.rs8 symbols
doku/src/lib.rs8 symbols
doku/src/printers/toml/print_scalar.rs7 symbols

For agents

$ claude mcp add doku \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact