draxl_printer/lib.rs
1#![forbid(unsafe_code)]
2//! Language-dispatch facade for canonical Draxl rendering.
3//!
4//! This crate renders the AST back into compact Draxl surface syntax and
5//! re-exports the shared canonicalization helper from `draxl-ast`.
6//!
7//! Today the crate exposes only the Rust backend, but the public rendering
8//! surface is language-aware so additional backends can be added behind the
9//! same facade over time.
10
11use draxl_ast::{File, LowerLanguage};
12
13pub use draxl_ast::canonicalize_file;
14
15/// Prints a file using the selected language backend.
16pub fn print_file_for_language(language: LowerLanguage, file: &File) -> String {
17 match language {
18 LowerLanguage::Rust => draxl_rust::print_file(file),
19 }
20}
21
22/// Prints a file using the default Rust backend.
23pub fn print_file(file: &File) -> String {
24 print_file_for_language(LowerLanguage::Rust, file)
25}