pub struct MultiFileGenerator {
pub use_mod_rs: bool,
pub root_file: String,
}Expand description
Generator that outputs code into multiple files.
This generator follows Rust’s module conventions:
Modern style (use_mod_rs = false):
src/
lib.rs # crate root
models.rs # mod models
models/
user.rs # mod models::user
post.rs # mod models::postLegacy style (use_mod_rs = true):
src/
lib.rs # crate root
models/
mod.rs # mod models
user.rs # mod models::user
post.rs # mod models::postFields§
§use_mod_rs: boolUse mod.rs style (legacy) instead of module.rs style (modern).
root_file: StringRoot file name (default: “lib.rs”).
Implementations§
Source§impl MultiFileGenerator
impl MultiFileGenerator
Sourcepub fn with_mod_rs_style(self) -> Self
pub fn with_mod_rs_style(self) -> Self
Use legacy mod.rs style.
Sourcepub fn with_root_file(self, name: impl Into<String>) -> Self
pub fn with_root_file(self, name: impl Into<String>) -> Self
Set root file name (e.g., “main.rs” for binaries).
Sourcepub fn generate(&self, tree: &ModuleTree) -> Result<GeneratedFiles, ToSynError>
pub fn generate(&self, tree: &ModuleTree) -> Result<GeneratedFiles, ToSynError>
Generate files from a ModuleTree.
Trait Implementations§
Source§impl Clone for MultiFileGenerator
impl Clone for MultiFileGenerator
Source§fn clone(&self) -> MultiFileGenerator
fn clone(&self) -> MultiFileGenerator
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MultiFileGenerator
impl Debug for MultiFileGenerator
Auto Trait Implementations§
impl Freeze for MultiFileGenerator
impl RefUnwindSafe for MultiFileGenerator
impl Send for MultiFileGenerator
impl Sync for MultiFileGenerator
impl Unpin for MultiFileGenerator
impl UnsafeUnpin for MultiFileGenerator
impl UnwindSafe for MultiFileGenerator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more