kotlin-codegen 0.2.0

A declaration model and renderer for generating Kotlin source code
Documentation
//! Kotlin code generator — a self-contained declaration model + renderer
//! (KotlinPoet-style "spec model with raw code bodies").
//!
//! Declarations (files, classes, functions, properties, parameters, types,
//! annotations) are typed model values; imports and formatting derive from
//! the model. Statement **bodies** stay raw Kotlin text structured through
//! the indentation-aware [`KtCode`] builder.
//!
//! This crate is deliberately dependency-free: it receives model values and
//! strings, and produces source text and file paths. Consumers build the
//! model; this crate renders it.

mod code;
mod file;
mod ident;
mod model;
mod render;
mod slot;
mod types;
mod validate;

#[cfg(test)]
mod tests;

pub use code::KtCode;
pub use file::{
    merge_files, merge_files_with, merged_file_path, write_files, write_files_with,
    WriteKotlinError,
};
pub use ident::{
    escape_kotlin_ident, is_escaped_kotlin_ident, is_kotlin_hard_keyword, is_valid_kotlin_ident,
    is_valid_kotlin_package, is_writable_kotlin_ident, mangle_kotlin_ident, mangle_kotlin_package,
    KOTLIN_HARD_KEYWORDS,
};
pub use model::{
    KtBody, KtClass, KtClassKind, KtClassModifier, KtCompanion, KtCtorParam, KtDecl, KtEnumEntry,
    KtFile, KtFun, KtFunInterface, KtFunSig, KtParam, KtProperty, KtSuperclass, KtSupertypes,
    KtVis,
};
pub use render::KOTLIN_BANNER;
pub use slot::KtPropertyValue;
pub use types::{ImportSet, KtType};
pub use validate::{Check, Diagnostic, Severity, ValidationPolicy};