kotlin-codegen 0.1.0

A declaration model and renderer for generating Kotlin source code
Documentation
  • Coverage
  • 44.04%
    48 out of 109 items documented0 out of 0 items with examples
  • Size
  • Source code size: 132.92 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.48 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • milyin/kotlin-codegen
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • milyin

kotlin-codegen

A declaration model and renderer for generating Kotlin source code.

Declarations (files, classes, functions, properties, parameters, types, annotations) are typed model values (KtFile, KtClass, KtFun, KtType, …); imports and formatting derive from the model automatically via ImportSet. Statement bodies stay raw Kotlin text, structured through the indentation-aware Code builder rather than modeled as a full expression AST.

You build a KtFile out of typed pieces, and the renderer produces formatted, import-complete Kotlin source text plus a file-writer that lays the result out on disk.

Why

This crate was made for the prebindgen-jni library, which generates JNI bindings for Rust libraries. The existing kotlin-poet-rs crate was not used for Not-Invented-Here reasons and because full control over the code generator was needed.

This crate will be supported as long as prebindgen-jni is alive.

Status

Early, dependency-free, and intentionally minimal. No macros, no derive, no external crates — just a plain declaration model and a renderer.

License

Licensed under either of

at your option.

Releasing

Publishing is automated from GitHub Actions. See RELEASING.md for the release process and CHANGELOG.md for release notes.