Skip to main content

Module codegen

Module codegen 

Source
Expand description

Code generation output and file writing.

This module defines the Code trait, which represents a single generated output file with a relative path and a content string.

IntoCode converts codegen types into Code. Any type that implements Code automatically implements IntoCode, so codegen types can implement either trait.

write_to_disk takes an output directory and any IntoCode value, creates intermediate directories as needed, and writes the file.

§Feature-gated blanket implementations

  • proc-macro2: (T, TokenStream) where T: AsRef<str> formats the token stream with prettyplease and writes it to the path given by T.

Re-exports§

pub use unique::UniqueNames;
pub use unique::WordSegments;

Modules§

unique

Traits§

Code
IntoCode

Functions§

write_to_disk