From 7615b2586d5888900ba38d426170aa237cf35d87 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Sat, 12 Feb 2022 19:02:34 +0000 Subject: [PATCH] Export `codegen::TypeGenerator` (#444) * Export codegen::TypeGenerator * Export Module and add comments to public methods * Fmt --- codegen/src/lib.rs | 6 +++++- codegen/src/types/mod.rs | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index e65dc261958f4..523b0d72ca712 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -25,5 +25,9 @@ pub use self::{ generate_runtime_api, RuntimeGenerator, }, - types::GeneratedTypeDerives, + types::{ + GeneratedTypeDerives, + Module, + TypeGenerator, + }, }; diff --git a/codegen/src/types/mod.rs b/codegen/src/types/mod.rs index b6972bdc7ff27..c29dbd341293e 100644 --- a/codegen/src/types/mod.rs +++ b/codegen/src/types/mod.rs @@ -221,6 +221,7 @@ impl<'a> TypeGenerator<'a> { } } +/// Represents a Rust `mod`, containing generated types and child `mod`s. #[derive(Debug)] pub struct Module<'a> { name: Ident, @@ -248,7 +249,8 @@ impl<'a> ToTokens for Module<'a> { } impl<'a> Module<'a> { - pub fn new(name: Ident, root_mod: Ident) -> Self { + /// Create a new [`Module`], with a reference to the root `mod` for resolving type paths. + pub(crate) fn new(name: Ident, root_mod: Ident) -> Self { Self { name, root_mod,