Skip to content

Commit

Permalink
Re-export service from root of the generated crate (#2010)
Browse files Browse the repository at this point in the history
  • Loading branch information
hlbarber authored Nov 18, 2022
1 parent c520b61 commit c370c8d
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import software.amazon.smithy.rust.codegen.core.rustlang.RustMetadata
import software.amazon.smithy.rust.codegen.core.rustlang.RustModule
import software.amazon.smithy.rust.codegen.core.rustlang.RustWriter
import software.amazon.smithy.rust.codegen.core.rustlang.Visibility
import software.amazon.smithy.rust.codegen.core.rustlang.rust
import software.amazon.smithy.rust.codegen.core.smithy.CodegenContext
import software.amazon.smithy.rust.codegen.core.smithy.RustCrate
import software.amazon.smithy.rust.codegen.core.smithy.generators.protocol.ProtocolSupport
Expand Down Expand Up @@ -40,6 +41,12 @@ open class ServerServiceGenerator(
* which assigns a symbol location to each shape.
*/
fun render() {
rustCrate.lib {
val serviceName = codegenContext.serviceShape.id.name.toString()
rust("##[doc(inline, hidden)]")
rust("pub use crate::service::$serviceName;")
}

rustCrate.withModule(RustModule.operation(Visibility.PRIVATE)) {
ServerProtocolTestGenerator(codegenContext, protocolSupport, protocolGenerator).render(this)
}
Expand Down

0 comments on commit c370c8d

Please sign in to comment.