Loading codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/rustlang/CargoDependency.kt +2 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,8 @@ class InlineDependency( val renderer: (RustWriter) -> Unit ) : RustDependency(name) { override fun version(): String { return renderer(RustWriter.forModule("_")).hashCode().toString() // just need a version that won't crash return renderer.hashCode().toString() } override fun dependencies(): List<RustDependency> { Loading codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/CodegenDelegator.kt +3 −1 Original line number Diff line number Diff line Loading @@ -45,15 +45,17 @@ open class RustCrate( } private fun injectInlineDependencies() { val writtenDependencies = mutableSetOf<String>() val unloadedDepdencies = { this .inner.dependencies .map { dep -> RustDependency.fromSymbolDependency(dep) } .filterIsInstance<InlineDependency>().distinctBy { it.key() } .filter { !modules.contains(it.module) } .filter { !writtenDependencies.contains(it.key()) } } while (unloadedDepdencies().isNotEmpty()) { unloadedDepdencies().forEach { dep -> writtenDependencies.add(dep.key()) this.withModule(RustModule.default(dep.module, false)) { dep.renderer(it) } Loading codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/Instantiator.kt +1 −2 Original line number Diff line number Diff line Loading @@ -233,12 +233,11 @@ class Instantiator( val variant = data.members.iterator().next() val memberName = variant.key.value val member = shape.expectMember(memberName) .let { model.expectShape(it.target) } // TODO: refactor this detail into UnionGenerator writer.write("#T::${memberName.toPascalCase()}", unionSymbol) // unions should specify exactly one member writer.withBlock("(", ")") { render(this, member, variant.value, ctx) renderMember(this, member, variant.value, ctx) } } Loading codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/http/ResponseBindingGenerator.kt +1 −1 Original line number Diff line number Diff line Loading @@ -83,7 +83,7 @@ class ResponseBindingGenerator(protocolConfig: ProtocolConfig, private val opera val target = model.expectShape(binding.member.target) check(target is MapShape) val fnName = "deser_prefix_header_${fnName(operationShape, binding)}" val inner = RuntimeType.forInlineFun("${fnName}_inner", "http_serde_inner") { val inner = RuntimeType.forInlineFun("${fnName}_inner", "http_serde") { it.rustBlock( "pub fn ${fnName}_inner(headers: #T::header::ValueIter<http::HeaderValue>) -> Result<Option<#T>, #T::ParseError>", RuntimeType.http, Loading codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/traits/SyntheticInputTrait.kt +1 −1 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ import software.amazon.smithy.model.traits.AnnotationTrait /** * Indicates that a shape is a synthetic input (see `OperationNormalizer.kt`) */ class SyntheticInputTrait constructor(val operation: ShapeId, val body: ShapeId?) : class SyntheticInputTrait constructor(val operation: ShapeId, val originalId: ShapeId?, val body: ShapeId?) : AnnotationTrait(ID, ObjectNode.fromStringMap(mapOf("body" to body.toString()))) { companion object { val ID = ShapeId.from("smithy.api.internal#syntheticInput") Loading Loading
codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/rustlang/CargoDependency.kt +2 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,8 @@ class InlineDependency( val renderer: (RustWriter) -> Unit ) : RustDependency(name) { override fun version(): String { return renderer(RustWriter.forModule("_")).hashCode().toString() // just need a version that won't crash return renderer.hashCode().toString() } override fun dependencies(): List<RustDependency> { Loading
codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/CodegenDelegator.kt +3 −1 Original line number Diff line number Diff line Loading @@ -45,15 +45,17 @@ open class RustCrate( } private fun injectInlineDependencies() { val writtenDependencies = mutableSetOf<String>() val unloadedDepdencies = { this .inner.dependencies .map { dep -> RustDependency.fromSymbolDependency(dep) } .filterIsInstance<InlineDependency>().distinctBy { it.key() } .filter { !modules.contains(it.module) } .filter { !writtenDependencies.contains(it.key()) } } while (unloadedDepdencies().isNotEmpty()) { unloadedDepdencies().forEach { dep -> writtenDependencies.add(dep.key()) this.withModule(RustModule.default(dep.module, false)) { dep.renderer(it) } Loading
codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/Instantiator.kt +1 −2 Original line number Diff line number Diff line Loading @@ -233,12 +233,11 @@ class Instantiator( val variant = data.members.iterator().next() val memberName = variant.key.value val member = shape.expectMember(memberName) .let { model.expectShape(it.target) } // TODO: refactor this detail into UnionGenerator writer.write("#T::${memberName.toPascalCase()}", unionSymbol) // unions should specify exactly one member writer.withBlock("(", ")") { render(this, member, variant.value, ctx) renderMember(this, member, variant.value, ctx) } } Loading
codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/http/ResponseBindingGenerator.kt +1 −1 Original line number Diff line number Diff line Loading @@ -83,7 +83,7 @@ class ResponseBindingGenerator(protocolConfig: ProtocolConfig, private val opera val target = model.expectShape(binding.member.target) check(target is MapShape) val fnName = "deser_prefix_header_${fnName(operationShape, binding)}" val inner = RuntimeType.forInlineFun("${fnName}_inner", "http_serde_inner") { val inner = RuntimeType.forInlineFun("${fnName}_inner", "http_serde") { it.rustBlock( "pub fn ${fnName}_inner(headers: #T::header::ValueIter<http::HeaderValue>) -> Result<Option<#T>, #T::ParseError>", RuntimeType.http, Loading
codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/traits/SyntheticInputTrait.kt +1 −1 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ import software.amazon.smithy.model.traits.AnnotationTrait /** * Indicates that a shape is a synthetic input (see `OperationNormalizer.kt`) */ class SyntheticInputTrait constructor(val operation: ShapeId, val body: ShapeId?) : class SyntheticInputTrait constructor(val operation: ShapeId, val originalId: ShapeId?, val body: ShapeId?) : AnnotationTrait(ID, ObjectNode.fromStringMap(mapOf("body" to body.toString()))) { companion object { val ID = ShapeId.from("smithy.api.internal#syntheticInput") Loading