diff --git a/CHANGELOG.next.toml b/CHANGELOG.next.toml index b1d81d97943..7770e39605f 100644 --- a/CHANGELOG.next.toml +++ b/CHANGELOG.next.toml @@ -74,3 +74,9 @@ message = "Add support for omitting session token in canonical requests for SigV references = ["smithy-rs#2473"] meta = { "breaking" = false, "tada" = false, "bug" = false } author = "martinjlowm" + +[[aws-sdk-rust]] +message = "Add `into_segments` method to `AggregatedBytes`, for zero-copy conversions." +references = ["smithy-rs#2525"] +meta = { "breaking" = false, "tada" = false, "bug" = false } +author = "parker-timmerman" diff --git a/codegen-server-test/build.gradle.kts b/codegen-server-test/build.gradle.kts index 693ed13c826..2dbeebca0a2 100644 --- a/codegen-server-test/build.gradle.kts +++ b/codegen-server-test/build.gradle.kts @@ -61,12 +61,7 @@ val allCodegenTests = "../codegen-core/common-test-models".let { commonModels -> "constraints", imports = listOf("$commonModels/constraints.smithy"), ), - CodegenTest( - "aws.protocoltests.restjson#RestJson", - "rest_json", - // TODO(https://github.com/awslabs/smithy-rs/issues/1401) `@uniqueItems` is used. - extraConfig = """, "codegen": { "ignoreUnsupportedConstraints": true } """, - ), + CodegenTest("aws.protocoltests.restjson#RestJson", "rest_json"), CodegenTest( "aws.protocoltests.restjson#RestJsonExtras", "rest_json_extras", @@ -75,26 +70,18 @@ val allCodegenTests = "../codegen-core/common-test-models".let { commonModels -> CodegenTest( "aws.protocoltests.restjson.validation#RestJsonValidation", "rest_json_validation", + // `@range` trait is used on floating point shapes, which we deliberately don't want to support. + // See https://github.com/awslabs/smithy-rs/issues/1401. extraConfig = """, "codegen": { "ignoreUnsupportedConstraints": true } """, ), CodegenTest("aws.protocoltests.json10#JsonRpc10", "json_rpc10"), - CodegenTest( - "aws.protocoltests.json#JsonProtocol", - "json_rpc11", - extraConfig = """, "codegen": { "ignoreUnsupportedConstraints": true } """, - ), + CodegenTest("aws.protocoltests.json#JsonProtocol", "json_rpc11"), CodegenTest( "aws.protocoltests.misc#MiscService", "misc", imports = listOf("$commonModels/misc.smithy"), - // TODO(https://github.com/awslabs/smithy-rs/issues/1401) `@uniqueItems` is used. - extraConfig = """, "codegen": { "ignoreUnsupportedConstraints": true } """, - ), - CodegenTest( - "com.amazonaws.ebs#Ebs", "ebs", - imports = listOf("$commonModels/ebs.json"), - extraConfig = """, "codegen": { "ignoreUnsupportedConstraints": true } """, ), + CodegenTest("com.amazonaws.ebs#Ebs", "ebs", imports = listOf("$commonModels/ebs.json")), CodegenTest("com.amazonaws.s3#AmazonS3", "s3"), CodegenTest( "com.aws.example.rust#PokemonService", diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ValidateUnsupportedConstraints.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ValidateUnsupportedConstraints.kt index 3a6cdabcd08..26f298c1913 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ValidateUnsupportedConstraints.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ValidateUnsupportedConstraints.kt @@ -262,7 +262,7 @@ fun validateUnsupportedConstraints( .map { (shape, rangeTrait) -> UnsupportedRangeTraitOnShape(shape, rangeTrait as RangeTrait) } .toSet() - // 5. `@uniqueItems` cannot reach a map shape. + // 4. `@uniqueItems` cannot reach a map shape. // See https://github.com/awslabs/smithy/issues/1567. val mapShapeReachableFromUniqueItemsListShapeSet = walker .walkShapes(service) diff --git a/rust-runtime/aws-smithy-http/src/byte_stream.rs b/rust-runtime/aws-smithy-http/src/byte_stream.rs index 3b99c0a68d8..fcd697c7b4f 100644 --- a/rust-runtime/aws-smithy-http/src/byte_stream.rs +++ b/rust-runtime/aws-smithy-http/src/byte_stream.rs @@ -477,6 +477,11 @@ impl AggregatedBytes { self.0.copy_to_bytes(self.0.remaining()) } + /// Convert this buffer into an [`Iterator`] of underlying non-contiguous segments of [`Bytes`] + pub fn into_segments(self) -> impl Iterator { + self.0.into_inner().into_iter() + } + /// Convert this buffer into a `Vec` pub fn to_vec(self) -> Vec { self.0 diff --git a/tools/ci-build/Dockerfile b/tools/ci-build/Dockerfile index b043866a31b..261c942b8b5 100644 --- a/tools/ci-build/Dockerfile +++ b/tools/ci-build/Dockerfile @@ -146,6 +146,7 @@ ARG rust_stable_version ARG rust_nightly_version RUN set -eux; \ yum -y install \ + bc \ ca-certificates \ gcc \ git \ diff --git a/tools/ci-scripts/check-only-aws-sdk-services b/tools/ci-scripts/check-only-aws-sdk-services index 03d000445dd..b15c4133b3d 100755 --- a/tools/ci-scripts/check-only-aws-sdk-services +++ b/tools/ci-scripts/check-only-aws-sdk-services @@ -21,10 +21,9 @@ for test_dir in tests/*; do fi done -# TODO(CrateReorganization): Uncomment when cleaning up `enableNewCrateOrganizationScheme` -# large_file_count="$(find sdk -iname '*.rs' -type f -size +1M | wc -l | bc)" -# if [[ "${large_file_count}" != "0" ]]; then -# echo "Found ${large_file_count} generated code files larger than 1 MB:" -# find sdk -iname '*.rs' -type f -size +1M -# exit 1 -# fi +large_file_count="$(find sdk -iname '*.rs' -type f -size +1M | wc -l | bc)" +if [[ "${large_file_count}" != "0" ]]; then + echo "Found ${large_file_count} generated code files larger than 1 MB:" + find sdk -iname '*.rs' -type f -size +1M + exit 1 +fi