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::AsKebabCase;
pub use unique::AsPascalCase;
pub use unique::AsSnakeCase;
pub use unique::NamePart;
pub use unique::UniqueName;
pub use unique::UniqueNames;

Modules§

unique
Naming support for generated code.

Structs§

WrittenFile
A record of a file that write_to_disk wrote.

Traits§

Code
IntoCode

Functions§

write_to_disk