Skip to content

Commit c370c8d

Browse files
authored
Re-export service from root of the generated crate (#2010)
1 parent c520b61 commit c370c8d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerServiceGenerator.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import software.amazon.smithy.rust.codegen.core.rustlang.RustMetadata
1212
import software.amazon.smithy.rust.codegen.core.rustlang.RustModule
1313
import software.amazon.smithy.rust.codegen.core.rustlang.RustWriter
1414
import software.amazon.smithy.rust.codegen.core.rustlang.Visibility
15+
import software.amazon.smithy.rust.codegen.core.rustlang.rust
1516
import software.amazon.smithy.rust.codegen.core.smithy.CodegenContext
1617
import software.amazon.smithy.rust.codegen.core.smithy.RustCrate
1718
import software.amazon.smithy.rust.codegen.core.smithy.generators.protocol.ProtocolSupport
@@ -40,6 +41,12 @@ open class ServerServiceGenerator(
4041
* which assigns a symbol location to each shape.
4142
*/
4243
fun render() {
44+
rustCrate.lib {
45+
val serviceName = codegenContext.serviceShape.id.name.toString()
46+
rust("##[doc(inline, hidden)]")
47+
rust("pub use crate::service::$serviceName;")
48+
}
49+
4350
rustCrate.withModule(RustModule.operation(Visibility.PRIVATE)) {
4451
ServerProtocolTestGenerator(codegenContext, protocolSupport, protocolGenerator).render(this)
4552
}

0 commit comments

Comments
 (0)