diff --git a/.github/workflows/library_rust_tests.yml b/.github/workflows/library_rust_tests.yml index 5e586c149..fdc8237cf 100644 --- a/.github/workflows/library_rust_tests.yml +++ b/.github/workflows/library_rust_tests.yml @@ -32,7 +32,7 @@ jobs: id-token: write contents: read env: - RUST_MIN_STACK: 404857600 + RUST_MIN_STACK: 838860800 steps: - name: Support longpaths on Git checkout run: | @@ -55,14 +55,11 @@ jobs: uses: actions-rust-lang/setup-rust-toolchain@v1.10.1 with: components: rustfmt - # uncomment this after Rust formatter works - # - name: Rustfmt Check - # uses: actions-rust-lang/rustfmt@v1 - name: Setup Dafny - uses: dafny-lang/setup-dafny-action@v1.7.0 + uses: dafny-lang/setup-dafny-action@v1.8.0 with: - dafny-version: nightly-2024-12-03-4954170 + dafny-version: nightly-2025-01-30-7db1e5f - name: Update MPL submodule if using MPL HEAD if: ${{ inputs.mpl-head == true }} @@ -73,16 +70,6 @@ jobs: git submodule update --init --recursive git rev-parse HEAD - # Remove this after the formatting in Rust starts working - - name: smithy-dafny Rust hacks - shell: bash - run: | - if [ "$RUNNER_OS" == "macOS" ]; then - sed -i '' 's|rustfmt --edition 2021 runtimes/rust/src/implementation_from_dafny.rs|#&|' submodules/smithy-dafny/SmithyDafnyMakefile.mk - else - sed -i 's|rustfmt --edition 2021 runtimes/rust/src/implementation_from_dafny.rs|#&|' submodules/smithy-dafny/SmithyDafnyMakefile.mk - fi - - name: Setup Java 17 for codegen uses: actions/setup-java@v3 with: @@ -123,6 +110,13 @@ jobs: run: | make test_rust + - name: Test ${{ matrix.library }} Rust Debug + if: ${{ matrix.library != 'TestVectors' }} + shell: bash + working-directory: ./${{ matrix.library }} + run: | + make test_rust test_rust_debug + - name: Test Examples for Rust in ${{ matrix.library }} if: ${{ matrix.library == 'DynamoDbEncryption' }} working-directory: ./${{ matrix.library }}/runtimes/rust/ diff --git a/.github/workflows/smithy-diff.yml b/.github/workflows/smithy-diff.yml index 7661bc580..df756f6a2 100644 --- a/.github/workflows/smithy-diff.yml +++ b/.github/workflows/smithy-diff.yml @@ -35,7 +35,7 @@ jobs: FILES: ${{ steps.file-changes.outputs.FILES }} if: ${{env.FILES != ''}} run: | - # TODO: If https://github.com/smithy-lang/smithy-dafny/issues/491 is resolved, remove comment about this issue. + # If https://github.com/smithy-lang/smithy-dafny/issues/491 is resolved, remove comment about this issue. COMMENT="@${{github.event.pull_request.user.login}} and @${{github.actor}}, I noticed you are updating the smithy model files.\nDoes this update need new or updated javadoc trait documentation?\n Are you adding constraints inside list, map or union? Do you know about this issue: https://github.com/smithy-lang/smithy-dafny/issues/491?" COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"$COMMENT\"}" diff --git a/DynamoDbEncryption/runtimes/rust/Cargo.toml b/DynamoDbEncryption/runtimes/rust/Cargo.toml index 9dcc9c7dc..9c2f41341 100644 --- a/DynamoDbEncryption/runtimes/rust/Cargo.toml +++ b/DynamoDbEncryption/runtimes/rust/Cargo.toml @@ -16,20 +16,20 @@ readme = "README.md" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -aws-config = "1.5.11" -aws-lc-rs = "1.12.0" -aws-lc-sys = "0.24.0" -aws-sdk-dynamodb = "1.56.0" -aws-sdk-kms = "1.52.0" +aws-config = "1.5.15" +aws-lc-rs = "1.12.2" +aws-lc-sys = "0.25.0" +aws-sdk-dynamodb = "1.62.0" +aws-sdk-kms = "1.57.0" aws-smithy-runtime-api = {version = "1.7.3", features = ["client"] } -aws-smithy-types = "1.2.10" +aws-smithy-types = "1.2.12" chrono = "0.4.39" cpu-time = "1.0.0" -dafny-runtime = "0.1.1" +dafny_runtime = { path = "../../../submodules/smithy-dafny/TestModels/dafny-dependencies/dafny_runtime_rust", features = ["sync"] } dashmap = "6.1.0" pem = "3.0.4" -tokio = {version = "1.42.0", features = ["full"] } -uuid = { version = "1.11.0", features = ["v4"] } +tokio = {version = "1.43.0", features = ["full"] } +uuid = { version = "1.12.1", features = ["v4"] } [[example]] name = "main" diff --git a/DynamoDbEncryption/runtimes/rust/RELEASE.md b/DynamoDbEncryption/runtimes/rust/RELEASE.md index ae5932b2b..77baff19b 100644 --- a/DynamoDbEncryption/runtimes/rust/RELEASE.md +++ b/DynamoDbEncryption/runtimes/rust/RELEASE.md @@ -1,6 +1,6 @@ To publish a new version of the aws-db-esdk for version N.N.N -1. Acquire the appropriate permissions +1. acquire the AWS permissions to run the tests 1. Ensure git checkout of main is fresh and clean 1. ./start_release.sh N.N.N 1. `cd ../../../releases/rust/db_esdk` diff --git a/DynamoDbEncryption/runtimes/rust/examples/basic_get_put_example.rs b/DynamoDbEncryption/runtimes/rust/examples/basic_get_put_example.rs index ffbfeb916..c5f91815b 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/basic_get_put_example.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/basic_get_put_example.rs @@ -5,13 +5,13 @@ use crate::test_utils; use aws_sdk_dynamodb::types::AttributeValue; use std::collections::HashMap; -use aws_db_esdk::CryptoAction; use aws_db_esdk::material_providers::client; use aws_db_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_db_esdk::CryptoAction; use aws_db_esdk::dynamodb::types::DynamoDbTableEncryptionConfig; -use aws_db_esdk::material_providers::types::DbeAlgorithmSuiteId; use aws_db_esdk::intercept::DbEsdkInterceptor; +use aws_db_esdk::material_providers::types::DbeAlgorithmSuiteId; use aws_db_esdk::types::dynamo_db_tables_encryption_config::DynamoDbTablesEncryptionConfig; /* diff --git a/DynamoDbEncryption/runtimes/rust/examples/clientsupplier/client_supplier_example.rs b/DynamoDbEncryption/runtimes/rust/examples/clientsupplier/client_supplier_example.rs index eb315e761..b8d564966 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/clientsupplier/client_supplier_example.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/clientsupplier/client_supplier_example.rs @@ -4,11 +4,11 @@ use super::regional_role_client_supplier::RegionalRoleClientSupplier; use crate::test_utils; use aws_db_esdk::dynamodb::types::DynamoDbTableEncryptionConfig; -use aws_db_esdk::CryptoAction; +use aws_db_esdk::intercept::DbEsdkInterceptor; use aws_db_esdk::material_providers::client as mpl_client; use aws_db_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; use aws_db_esdk::material_providers::types::DiscoveryFilter; -use aws_db_esdk::intercept::DbEsdkInterceptor; +use aws_db_esdk::CryptoAction; use aws_db_esdk::DynamoDbTablesEncryptionConfig; use aws_sdk_dynamodb::types::AttributeValue; use std::collections::HashMap; diff --git a/DynamoDbEncryption/runtimes/rust/examples/clientsupplier/regional_role_client_supplier.rs b/DynamoDbEncryption/runtimes/rust/examples/clientsupplier/regional_role_client_supplier.rs index 353645640..e1d485321 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/clientsupplier/regional_role_client_supplier.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/clientsupplier/regional_role_client_supplier.rs @@ -2,10 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 use aws_config::Region; +use aws_db_esdk::com_amazonaws_kms::client::Client as kms_client; use aws_db_esdk::material_providers::operation::get_client::GetClientInput; use aws_db_esdk::material_providers::types::error::Error; use aws_db_esdk::material_providers::types::ClientSupplier; -use aws_db_esdk::com_amazonaws_kms::client::Client as kms_client; /* Example class demonstrating an implementation of a custom client supplier. diff --git a/DynamoDbEncryption/runtimes/rust/examples/itemencryptor/item_encrypt_decrypt.rs b/DynamoDbEncryption/runtimes/rust/examples/itemencryptor/item_encrypt_decrypt.rs index 92e95a5ca..db96a94ac 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/itemencryptor/item_encrypt_decrypt.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/itemencryptor/item_encrypt_decrypt.rs @@ -5,12 +5,12 @@ use crate::test_utils; use aws_sdk_dynamodb::types::AttributeValue; use std::collections::HashMap; -use aws_db_esdk::CryptoAction; use aws_db_esdk::material_providers::client as mpl_client; use aws_db_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_db_esdk::CryptoAction; -use aws_db_esdk::item_encryptor::types::dynamo_db_item_encryptor_config::DynamoDbItemEncryptorConfig; use aws_db_esdk::item_encryptor::client as enc_client; +use aws_db_esdk::item_encryptor::types::dynamo_db_item_encryptor_config::DynamoDbItemEncryptorConfig; use aws_db_esdk::material_providers::types::DbeAlgorithmSuiteId; /* diff --git a/DynamoDbEncryption/runtimes/rust/examples/keyring/hierarchical_keyring.rs b/DynamoDbEncryption/runtimes/rust/examples/keyring/hierarchical_keyring.rs index 287a8c659..df8142658 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/keyring/hierarchical_keyring.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/keyring/hierarchical_keyring.rs @@ -5,14 +5,14 @@ use super::branch_key_id_supplier::ExampleBranchKeyIdSupplier; use crate::test_utils; use aws_db_esdk::dynamodb::client as dbesdk_client; use aws_db_esdk::dynamodb::types::dynamo_db_encryption_config::DynamoDbEncryptionConfig; +use aws_db_esdk::dynamodb::types::DynamoDbTableEncryptionConfig; +use aws_db_esdk::intercept::DbEsdkInterceptor; use aws_db_esdk::key_store::client as keystore_client; use aws_db_esdk::key_store::types::key_store_config::KeyStoreConfig; use aws_db_esdk::key_store::types::KmsConfiguration; use aws_db_esdk::material_providers::client as mpl_client; use aws_db_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; -use aws_db_esdk::dynamodb::types::DynamoDbTableEncryptionConfig; use aws_db_esdk::CryptoAction; -use aws_db_esdk::intercept::DbEsdkInterceptor; use aws_db_esdk::DynamoDbTablesEncryptionConfig; use aws_sdk_dynamodb::types::AttributeValue; use std::collections::HashMap; diff --git a/DynamoDbEncryption/runtimes/rust/examples/keyring/kms_rsa_keyring.rs b/DynamoDbEncryption/runtimes/rust/examples/keyring/kms_rsa_keyring.rs index e65ffa829..7ae049175 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/keyring/kms_rsa_keyring.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/keyring/kms_rsa_keyring.rs @@ -3,11 +3,11 @@ use crate::test_utils; use aws_db_esdk::dynamodb::types::DynamoDbTableEncryptionConfig; -use aws_db_esdk::CryptoAction; +use aws_db_esdk::intercept::DbEsdkInterceptor; use aws_db_esdk::material_providers::client as mpl_client; use aws_db_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; use aws_db_esdk::material_providers::types::DbeAlgorithmSuiteId; -use aws_db_esdk::intercept::DbEsdkInterceptor; +use aws_db_esdk::CryptoAction; use aws_db_esdk::DynamoDbTablesEncryptionConfig; use aws_sdk_dynamodb::types::AttributeValue; use std::collections::HashMap; @@ -15,7 +15,7 @@ use std::fs::File; use std::io::Read; use std::io::Write; use std::path::Path; - + /* This example sets up DynamoDb Encryption for the AWS SDK client using the KMS RSA Keyring. This keyring uses a KMS RSA key pair to diff --git a/DynamoDbEncryption/runtimes/rust/examples/keyring/mrk_discovery_multi_keyring.rs b/DynamoDbEncryption/runtimes/rust/examples/keyring/mrk_discovery_multi_keyring.rs index 55f895562..689bdd4cb 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/keyring/mrk_discovery_multi_keyring.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/keyring/mrk_discovery_multi_keyring.rs @@ -3,11 +3,11 @@ use crate::test_utils; use aws_db_esdk::dynamodb::types::DynamoDbTableEncryptionConfig; -use aws_db_esdk::CryptoAction; +use aws_db_esdk::intercept::DbEsdkInterceptor; use aws_db_esdk::material_providers::client as mpl_client; use aws_db_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; use aws_db_esdk::material_providers::types::DiscoveryFilter; -use aws_db_esdk::intercept::DbEsdkInterceptor; +use aws_db_esdk::CryptoAction; use aws_db_esdk::DynamoDbTablesEncryptionConfig; use aws_sdk_dynamodb::types::AttributeValue; use std::collections::HashMap; diff --git a/DynamoDbEncryption/runtimes/rust/examples/keyring/multi_keyring.rs b/DynamoDbEncryption/runtimes/rust/examples/keyring/multi_keyring.rs index 2fcfe8cd7..cb0543b1e 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/keyring/multi_keyring.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/keyring/multi_keyring.rs @@ -3,11 +3,11 @@ use crate::test_utils; use aws_db_esdk::dynamodb::types::DynamoDbTableEncryptionConfig; -use aws_db_esdk::CryptoAction; +use aws_db_esdk::intercept::DbEsdkInterceptor; use aws_db_esdk::material_providers::client as mpl_client; use aws_db_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; use aws_db_esdk::material_providers::types::AesWrappingAlg; -use aws_db_esdk::intercept::DbEsdkInterceptor; +use aws_db_esdk::CryptoAction; use aws_db_esdk::DynamoDbTablesEncryptionConfig; use aws_sdk_dynamodb::types::AttributeValue; use std::collections::HashMap; diff --git a/DynamoDbEncryption/runtimes/rust/examples/keyring/multi_mrk_keyring.rs b/DynamoDbEncryption/runtimes/rust/examples/keyring/multi_mrk_keyring.rs index 115f3c16d..7151ac552 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/keyring/multi_mrk_keyring.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/keyring/multi_mrk_keyring.rs @@ -3,10 +3,10 @@ use crate::test_utils; use aws_db_esdk::dynamodb::types::DynamoDbTableEncryptionConfig; -use aws_db_esdk::CryptoAction; +use aws_db_esdk::intercept::DbEsdkInterceptor; use aws_db_esdk::material_providers::client as mpl_client; use aws_db_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; -use aws_db_esdk::intercept::DbEsdkInterceptor; +use aws_db_esdk::CryptoAction; use aws_db_esdk::DynamoDbTablesEncryptionConfig; use aws_sdk_dynamodb::types::AttributeValue; use std::collections::HashMap; diff --git a/DynamoDbEncryption/runtimes/rust/examples/keyring/raw_aes_keyring.rs b/DynamoDbEncryption/runtimes/rust/examples/keyring/raw_aes_keyring.rs index 91775090e..fc22e4deb 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/keyring/raw_aes_keyring.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/keyring/raw_aes_keyring.rs @@ -3,11 +3,11 @@ use crate::test_utils; use aws_db_esdk::dynamodb::types::DynamoDbTableEncryptionConfig; -use aws_db_esdk::CryptoAction; +use aws_db_esdk::intercept::DbEsdkInterceptor; use aws_db_esdk::material_providers::client as mpl_client; use aws_db_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; use aws_db_esdk::material_providers::types::AesWrappingAlg; -use aws_db_esdk::intercept::DbEsdkInterceptor; +use aws_db_esdk::CryptoAction; use aws_db_esdk::DynamoDbTablesEncryptionConfig; use aws_sdk_dynamodb::types::AttributeValue; use std::collections::HashMap; diff --git a/DynamoDbEncryption/runtimes/rust/examples/keyring/raw_rsa_keyring.rs b/DynamoDbEncryption/runtimes/rust/examples/keyring/raw_rsa_keyring.rs index 4c6c6d331..408db258e 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/keyring/raw_rsa_keyring.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/keyring/raw_rsa_keyring.rs @@ -3,11 +3,11 @@ use crate::test_utils; use aws_db_esdk::dynamodb::types::DynamoDbTableEncryptionConfig; -use aws_db_esdk::CryptoAction; +use aws_db_esdk::intercept::DbEsdkInterceptor; use aws_db_esdk::material_providers::client as mpl_client; use aws_db_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; use aws_db_esdk::material_providers::types::PaddingScheme; -use aws_db_esdk::intercept::DbEsdkInterceptor; +use aws_db_esdk::CryptoAction; use aws_db_esdk::DynamoDbTablesEncryptionConfig; use aws_sdk_dynamodb::types::AttributeValue; use std::collections::HashMap; diff --git a/DynamoDbEncryption/runtimes/rust/examples/multi_get_put_example.rs b/DynamoDbEncryption/runtimes/rust/examples/multi_get_put_example.rs index 02aab30fc..c0acca1c8 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/multi_get_put_example.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/multi_get_put_example.rs @@ -5,13 +5,13 @@ use crate::test_utils; use aws_sdk_dynamodb::types::AttributeValue; use std::collections::HashMap; -use aws_db_esdk::CryptoAction; use aws_db_esdk::material_providers::client; use aws_db_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_db_esdk::CryptoAction; use aws_db_esdk::dynamodb::types::DynamoDbTableEncryptionConfig; -use aws_db_esdk::material_providers::types::DbeAlgorithmSuiteId; use aws_db_esdk::intercept::DbEsdkInterceptor; +use aws_db_esdk::material_providers::types::DbeAlgorithmSuiteId; use aws_db_esdk::types::dynamo_db_tables_encryption_config::DynamoDbTablesEncryptionConfig; /* diff --git a/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/basic_searchable_encryption.rs b/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/basic_searchable_encryption.rs index d9b8cc47d..ff89bd578 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/basic_searchable_encryption.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/basic_searchable_encryption.rs @@ -5,9 +5,9 @@ use crate::test_utils; use aws_sdk_dynamodb::types::AttributeValue; use std::collections::HashMap; -use aws_db_esdk::CryptoAction; use aws_db_esdk::material_providers::client; use aws_db_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_db_esdk::CryptoAction; use aws_db_esdk::dynamodb::types::BeaconKeySource; use aws_db_esdk::dynamodb::types::BeaconVersion; @@ -15,10 +15,10 @@ use aws_db_esdk::dynamodb::types::DynamoDbTableEncryptionConfig; use aws_db_esdk::dynamodb::types::SearchConfig; use aws_db_esdk::dynamodb::types::SingleKeyStore; use aws_db_esdk::dynamodb::types::StandardBeacon; +use aws_db_esdk::intercept::DbEsdkInterceptor; use aws_db_esdk::key_store::client as keystore_client; use aws_db_esdk::key_store::types::key_store_config::KeyStoreConfig; use aws_db_esdk::key_store::types::KmsConfiguration; -use aws_db_esdk::intercept::DbEsdkInterceptor; use aws_db_esdk::types::dynamo_db_tables_encryption_config::DynamoDbTablesEncryptionConfig; /* @@ -52,305 +52,309 @@ use aws_db_esdk::types::dynamo_db_tables_encryption_config::DynamoDbTablesEncryp const GSI_NAME: &str = "last4-unit-index"; pub async fn put_and_query_with_beacon(branch_key_id: &str) -> Result<(), crate::BoxError> { - let ddb_table_name = test_utils::UNIT_INSPECTION_TEST_DDB_TABLE_NAME; - let branch_key_wrapping_kms_key_arn = test_utils::TEST_BRANCH_KEY_WRAPPING_KMS_KEY_ARN; - let branch_key_ddb_table_name = test_utils::TEST_BRANCH_KEYSTORE_DDB_TABLE_NAME; - - // 1. Configure Beacons. - // The beacon name must be the name of a table attribute that will be encrypted. - // The `length` parameter dictates how many bits are in the beacon attribute value. - // The following link provides guidance on choosing a beacon length: - // https://docs.aws.amazon.com/database-encryption-sdk/latest/devguide/choosing-beacon-length.html - - // The configured DDB table has a GSI on the `aws_dbe_b_inspector_id_last4` AttributeName. - // This field holds the last 4 digits of an inspector ID. - // For our example, this field may range from 0 to 9,999 (10,000 possible values). - // For our example, we assume a full inspector ID is an integer - // ranging from 0 to 99,999,999. We do not assume that the full inspector ID's - // values are uniformly distributed across its range of possible values. - // In many use cases, the prefix of an identifier encodes some information - // about that identifier (e.g. zipcode and SSN prefixes encode geographic - // information), while the suffix does not and is more uniformly distributed. - // We will assume that the inspector ID field matches a similar use case. - // So for this example, we only store and use the last - // 4 digits of the inspector ID, which we assume is uniformly distributed. - // Since the full ID's range is divisible by the range of the last 4 digits, - // then the last 4 digits of the inspector ID are uniformly distributed - // over the range from 0 to 9,999. - // See our documentation for why you should avoid creating beacons over non-uniform distributions - // https://docs.aws.amazon.com/database-encryption-sdk/latest/devguide/searchable-encryption.html#are-beacons-right-for-me - // A single inspector ID suffix may be assigned to multiple `work_id`s. - // - // This link provides guidance for choosing a beacon length: - // https://docs.aws.amazon.com/database-encryption-sdk/latest/devguide/choosing-beacon-length.html - // We follow the guidance in the link above to determine reasonable bounds - // for the length of a beacon on the last 4 digits of an inspector ID: - // - min: log(sqrt(10,000))/log(2) ~= 6.6, round up to 7 - // - max: log((10,000/2))/log(2) ~= 12.3, round down to 12 - // You will somehow need to round results to a nearby integer. - // We choose to round to the nearest integer; you might consider a different rounding approach. - // Rounding up will return fewer expected "false positives" in queries, - // leading to fewer decrypt calls and better performance, - // but it is easier to identify which beacon values encode distinct plaintexts. - // Rounding down will return more expected "false positives" in queries, - // leading to more decrypt calls and worse performance, - // but it is harder to identify which beacon values encode distinct plaintexts. - // We can choose a beacon length between 7 and 12: - // - Closer to 7, we expect more "false positives" to be returned, - // making it harder to identify which beacon values encode distinct plaintexts, - // but leading to more decrypt calls and worse performance - // - Closer to 12, we expect fewer "false positives" returned in queries, - // leading to fewer decrypt calls and better performance, - // but it is easier to identify which beacon values encode distinct plaintexts. - // As an example, we will choose 10. - // - // Values stored in aws_dbe_b_inspector_id_last4 will be 10 bits long (0x000 - 0x3ff) - // There will be 2^10 = 1,024 possible HMAC values. - // With a sufficiently large number of well-distributed inspector IDs, - // for a particular beacon we expect (10,000/1,024) ~= 9.8 4-digit inspector ID suffixes - // sharing that beacon value. - let last4_beacon = StandardBeacon::builder() - .name("inspector_id_last4") - .length(10) - .build()?; - - // The configured DDB table has a GSI on the `aws_dbe_b_unit` AttributeName. - // This field holds a unit serial number. - // For this example, this is a 12-digit integer from 0 to 999,999,999,999 (10^12 possible values). - // We will assume values for this attribute are uniformly distributed across this range. - // A single unit serial number may be assigned to multiple `work_id`s. - // - // This link provides guidance for choosing a beacon length: - // https://docs.aws.amazon.com/database-encryption-sdk/latest/devguide/choosing-beacon-length.html - // We follow the guidance in the link above to determine reasonable bounds - // for the length of a beacon on a unit serial number: - // - min: log(sqrt(999,999,999,999))/log(2) ~= 19.9, round up to 20 - // - max: log((999,999,999,999/2))/log(2) ~= 38.9, round up to 39 - // We can choose a beacon length between 20 and 39: - // - Closer to 20, we expect more "false positives" to be returned, - // making it harder to identify which beacon values encode distinct plaintexts, - // but leading to more decrypt calls and worse performance - // - Closer to 39, we expect fewer "false positives" returned in queries, - // leading to fewer decrypt calls and better performance, - // but it is easier to identify which beacon values encode distinct plaintexts. - // As an example, we will choose 30. - // - // Values stored in aws_dbe_b_unit will be 30 bits long (0x00000000 - 0x3fffffff) - // There will be 2^30 = 1,073,741,824 ~= 1.1B possible HMAC values. - // With a sufficiently large number of well-distributed inspector IDs, - // for a particular beacon we expect (10^12/2^30) ~= 931.3 unit serial numbers - // sharing that beacon value. - let unit_beacon = StandardBeacon::builder().name("unit").length(30).build()?; + // The whole thing is wrapped in a future to ensure that everything is Send and Sync + let future = async move { + let ddb_table_name = test_utils::UNIT_INSPECTION_TEST_DDB_TABLE_NAME; + let branch_key_wrapping_kms_key_arn = test_utils::TEST_BRANCH_KEY_WRAPPING_KMS_KEY_ARN; + let branch_key_ddb_table_name = test_utils::TEST_BRANCH_KEYSTORE_DDB_TABLE_NAME; - let standard_beacon_list = vec![last4_beacon, unit_beacon]; + // 1. Configure Beacons. + // The beacon name must be the name of a table attribute that will be encrypted. + // The `length` parameter dictates how many bits are in the beacon attribute value. + // The following link provides guidance on choosing a beacon length: + // https://docs.aws.amazon.com/database-encryption-sdk/latest/devguide/choosing-beacon-length.html - // 2. Configure Keystore. - // The keystore is a separate DDB table where the client stores encryption and decryption materials. - // In order to configure beacons on the DDB client, you must configure a keystore. - // - // This example expects that you have already set up a KeyStore with a single branch key. - // See the "Create KeyStore Table Example" and "Create KeyStore Key Example" for how to do this. - // After you create a branch key, you should persist its ID for use in this example. - let sdk_config = aws_config::load_defaults(aws_config::BehaviorVersion::latest()).await; - let key_store_config = KeyStoreConfig::builder() - .kms_client(aws_sdk_kms::Client::new(&sdk_config)) - .ddb_client(aws_sdk_dynamodb::Client::new(&sdk_config)) - .ddb_table_name(branch_key_ddb_table_name) - .logical_key_store_name(branch_key_ddb_table_name) - .kms_configuration(KmsConfiguration::KmsKeyArn( - branch_key_wrapping_kms_key_arn.to_string(), - )) - .build()?; + // The configured DDB table has a GSI on the `aws_dbe_b_inspector_id_last4` AttributeName. + // This field holds the last 4 digits of an inspector ID. + // For our example, this field may range from 0 to 9,999 (10,000 possible values). + // For our example, we assume a full inspector ID is an integer + // ranging from 0 to 99,999,999. We do not assume that the full inspector ID's + // values are uniformly distributed across its range of possible values. + // In many use cases, the prefix of an identifier encodes some information + // about that identifier (e.g. zipcode and SSN prefixes encode geographic + // information), while the suffix does not and is more uniformly distributed. + // We will assume that the inspector ID field matches a similar use case. + // So for this example, we only store and use the last + // 4 digits of the inspector ID, which we assume is uniformly distributed. + // Since the full ID's range is divisible by the range of the last 4 digits, + // then the last 4 digits of the inspector ID are uniformly distributed + // over the range from 0 to 9,999. + // See our documentation for why you should avoid creating beacons over non-uniform distributions + // https://docs.aws.amazon.com/database-encryption-sdk/latest/devguide/searchable-encryption.html#are-beacons-right-for-me + // A single inspector ID suffix may be assigned to multiple `work_id`s. + // + // This link provides guidance for choosing a beacon length: + // https://docs.aws.amazon.com/database-encryption-sdk/latest/devguide/choosing-beacon-length.html + // We follow the guidance in the link above to determine reasonable bounds + // for the length of a beacon on the last 4 digits of an inspector ID: + // - min: log(sqrt(10,000))/log(2) ~= 6.6, round up to 7 + // - max: log((10,000/2))/log(2) ~= 12.3, round down to 12 + // You will somehow need to round results to a nearby integer. + // We choose to round to the nearest integer; you might consider a different rounding approach. + // Rounding up will return fewer expected "false positives" in queries, + // leading to fewer decrypt calls and better performance, + // but it is easier to identify which beacon values encode distinct plaintexts. + // Rounding down will return more expected "false positives" in queries, + // leading to more decrypt calls and worse performance, + // but it is harder to identify which beacon values encode distinct plaintexts. + // We can choose a beacon length between 7 and 12: + // - Closer to 7, we expect more "false positives" to be returned, + // making it harder to identify which beacon values encode distinct plaintexts, + // but leading to more decrypt calls and worse performance + // - Closer to 12, we expect fewer "false positives" returned in queries, + // leading to fewer decrypt calls and better performance, + // but it is easier to identify which beacon values encode distinct plaintexts. + // As an example, we will choose 10. + // + // Values stored in aws_dbe_b_inspector_id_last4 will be 10 bits long (0x000 - 0x3ff) + // There will be 2^10 = 1,024 possible HMAC values. + // With a sufficiently large number of well-distributed inspector IDs, + // for a particular beacon we expect (10,000/1,024) ~= 9.8 4-digit inspector ID suffixes + // sharing that beacon value. + let last4_beacon = StandardBeacon::builder() + .name("inspector_id_last4") + .length(10) + .build()?; - let key_store = keystore_client::Client::from_conf(key_store_config)?; + // The configured DDB table has a GSI on the `aws_dbe_b_unit` AttributeName. + // This field holds a unit serial number. + // For this example, this is a 12-digit integer from 0 to 999,999,999,999 (10^12 possible values). + // We will assume values for this attribute are uniformly distributed across this range. + // A single unit serial number may be assigned to multiple `work_id`s. + // + // This link provides guidance for choosing a beacon length: + // https://docs.aws.amazon.com/database-encryption-sdk/latest/devguide/choosing-beacon-length.html + // We follow the guidance in the link above to determine reasonable bounds + // for the length of a beacon on a unit serial number: + // - min: log(sqrt(999,999,999,999))/log(2) ~= 19.9, round up to 20 + // - max: log((999,999,999,999/2))/log(2) ~= 38.9, round up to 39 + // We can choose a beacon length between 20 and 39: + // - Closer to 20, we expect more "false positives" to be returned, + // making it harder to identify which beacon values encode distinct plaintexts, + // but leading to more decrypt calls and worse performance + // - Closer to 39, we expect fewer "false positives" returned in queries, + // leading to fewer decrypt calls and better performance, + // but it is easier to identify which beacon values encode distinct plaintexts. + // As an example, we will choose 30. + // + // Values stored in aws_dbe_b_unit will be 30 bits long (0x00000000 - 0x3fffffff) + // There will be 2^30 = 1,073,741,824 ~= 1.1B possible HMAC values. + // With a sufficiently large number of well-distributed inspector IDs, + // for a particular beacon we expect (10^12/2^30) ~= 931.3 unit serial numbers + // sharing that beacon value. + let unit_beacon = StandardBeacon::builder().name("unit").length(30).build()?; - // 3. Create BeaconVersion. - // The BeaconVersion inside the list holds the list of beacons on the table. - // The BeaconVersion also stores information about the keystore. - // BeaconVersion must be provided: - // - keyStore: The keystore configured in step 2. - // - keySource: A configuration for the key source. - // For simple use cases, we can configure a 'singleKeySource' which - // statically configures a single beaconKey. That is the approach this example takes. - // For use cases where you want to use different beacon keys depending on the data - // (for example if your table holds data for multiple tenants, and you want to use - // a different beacon key per tenant), look into configuring a MultiKeyStore: - // https://docs.aws.amazon.com/database-encryption-sdk/latest/devguide/searchable-encryption-multitenant.html + let standard_beacon_list = vec![last4_beacon, unit_beacon]; - let beacon_version = BeaconVersion::builder() - .standard_beacons(standard_beacon_list) - .version(1) // MUST be 1 - .key_store(key_store.clone()) - .key_source(BeaconKeySource::Single( - SingleKeyStore::builder() - // `keyId` references a beacon key. - // For every branch key we create in the keystore, - // we also create a beacon key. - // This beacon key is not the same as the branch key, - // but is created with the same ID as the branch key. - .key_id(branch_key_id) - .cache_ttl(6000) - .build()?, - )) - .build()?; - let beacon_versions = vec![beacon_version]; + // 2. Configure Keystore. + // The keystore is a separate DDB table where the client stores encryption and decryption materials. + // In order to configure beacons on the DDB client, you must configure a keystore. + // + // This example expects that you have already set up a KeyStore with a single branch key. + // See the "Create KeyStore Table Example" and "Create KeyStore Key Example" for how to do this. + // After you create a branch key, you should persist its ID for use in this example. + let sdk_config = aws_config::load_defaults(aws_config::BehaviorVersion::latest()).await; + let key_store_config = KeyStoreConfig::builder() + .kms_client(aws_sdk_kms::Client::new(&sdk_config)) + .ddb_client(aws_sdk_dynamodb::Client::new(&sdk_config)) + .ddb_table_name(branch_key_ddb_table_name) + .logical_key_store_name(branch_key_ddb_table_name) + .kms_configuration(KmsConfiguration::KmsKeyArn( + branch_key_wrapping_kms_key_arn.to_string(), + )) + .build()?; - // 4. Create a Hierarchical Keyring - // This is a KMS keyring that utilizes the keystore table. - // This config defines how items are encrypted and decrypted. - // NOTE: You should configure this to use the same keystore as your search config. - let provider_config = MaterialProvidersConfig::builder().build()?; - let mat_prov = client::Client::from_conf(provider_config)?; - let kms_keyring = mat_prov - .create_aws_kms_hierarchical_keyring() - .branch_key_id(branch_key_id) - .key_store(key_store) - .ttl_seconds(6000) - .send() - .await?; + let key_store = keystore_client::Client::from_conf(key_store_config)?; - // 5. Configure which attributes are encrypted and/or signed when writing new items. - // For each attribute that may exist on the items we plan to write to our DynamoDbTable, - // we must explicitly configure how they should be treated during item encryption: - // - ENCRYPT_AND_SIGN: The attribute is encrypted and included in the signature - // - SIGN_ONLY: The attribute not encrypted, but is still included in the signature - // - DO_NOTHING: The attribute is not encrypted and not included in the signature - // Any attributes that will be used in beacons must be configured as ENCRYPT_AND_SIGN. - let attribute_actions_on_encrypt = HashMap::from([ - ("work_id".to_string(), CryptoAction::SignOnly), // Our partition attribute must be SIGN_ONLY - ("inspection_date".to_string(), CryptoAction::SignOnly), // Our sort attribute must be SIGN_ONLY - ( - "inspector_id_last4".to_string(), - CryptoAction::EncryptAndSign, - ), // Beaconized attributes must be encrypted - ("unit".to_string(), CryptoAction::EncryptAndSign), // Beaconized attributes must be encrypted - ]); + // 3. Create BeaconVersion. + // The BeaconVersion inside the list holds the list of beacons on the table. + // The BeaconVersion also stores information about the keystore. + // BeaconVersion must be provided: + // - keyStore: The keystore configured in step 2. + // - keySource: A configuration for the key source. + // For simple use cases, we can configure a 'singleKeySource' which + // statically configures a single beaconKey. That is the approach this example takes. + // For use cases where you want to use different beacon keys depending on the data + // (for example if your table holds data for multiple tenants, and you want to use + // a different beacon key per tenant), look into configuring a MultiKeyStore: + // https://docs.aws.amazon.com/database-encryption-sdk/latest/devguide/searchable-encryption-multitenant.html - // 6. Create the DynamoDb Encryption configuration for the table we will be writing to. - // The beaconVersions are added to the search configuration. - let table_config = DynamoDbTableEncryptionConfig::builder() - .logical_table_name(ddb_table_name) - .partition_key_name("work_id") - .sort_key_name("inspection_date") - .attribute_actions_on_encrypt(attribute_actions_on_encrypt) - .keyring(kms_keyring) - .search( - SearchConfig::builder() - .write_version(1) // MUST be 1 - .versions(beacon_versions) - .build()?, - ) - .build()?; + let beacon_version = BeaconVersion::builder() + .standard_beacons(standard_beacon_list) + .version(1) // MUST be 1 + .key_store(key_store.clone()) + .key_source(BeaconKeySource::Single( + SingleKeyStore::builder() + // `keyId` references a beacon key. + // For every branch key we create in the keystore, + // we also create a beacon key. + // This beacon key is not the same as the branch key, + // but is created with the same ID as the branch key. + .key_id(branch_key_id) + .cache_ttl(6000) + .build()?, + )) + .build()?; + let beacon_versions = vec![beacon_version]; - let table_configs = DynamoDbTablesEncryptionConfig::builder() - .table_encryption_configs(HashMap::from([(ddb_table_name.to_string(), table_config)])) - .build()?; + // 4. Create a Hierarchical Keyring + // This is a KMS keyring that utilizes the keystore table. + // This config defines how items are encrypted and decrypted. + // NOTE: You should configure this to use the same keystore as your search config. + let provider_config = MaterialProvidersConfig::builder().build()?; + let mat_prov = client::Client::from_conf(provider_config)?; + let kms_keyring = mat_prov + .create_aws_kms_hierarchical_keyring() + .branch_key_id(branch_key_id) + .key_store(key_store) + .ttl_seconds(6000) + .send() + .await?; - // 7. Create a new AWS SDK DynamoDb client using the TableEncryptionConfigs - let sdk_config = aws_config::load_defaults(aws_config::BehaviorVersion::latest()).await; - let dynamo_config = aws_sdk_dynamodb::config::Builder::from(&sdk_config) - .interceptor(DbEsdkInterceptor::new(table_configs)?) - .build(); - let ddb = aws_sdk_dynamodb::Client::from_conf(dynamo_config); + // 5. Configure which attributes are encrypted and/or signed when writing new items. + // For each attribute that may exist on the items we plan to write to our DynamoDbTable, + // we must explicitly configure how they should be treated during item encryption: + // - ENCRYPT_AND_SIGN: The attribute is encrypted and included in the signature + // - SIGN_ONLY: The attribute not encrypted, but is still included in the signature + // - DO_NOTHING: The attribute is not encrypted and not included in the signature + // Any attributes that will be used in beacons must be configured as ENCRYPT_AND_SIGN. + let attribute_actions_on_encrypt = HashMap::from([ + ("work_id".to_string(), CryptoAction::SignOnly), // Our partition attribute must be SIGN_ONLY + ("inspection_date".to_string(), CryptoAction::SignOnly), // Our sort attribute must be SIGN_ONLY + ( + "inspector_id_last4".to_string(), + CryptoAction::EncryptAndSign, + ), // Beaconized attributes must be encrypted + ("unit".to_string(), CryptoAction::EncryptAndSign), // Beaconized attributes must be encrypted + ]); - // 8. Put an item into our table using the above client. - // Before the item gets sent to DynamoDb, it will be encrypted - // client-side, according to our configuration. - // Since our configuration includes beacons for `inspector_id_last4` and `unit`, - // the client will add two additional attributes to the item. These attributes will have names - // `aws_dbe_b_inspector_id_last4` and `aws_dbe_b_unit`. Their values will be HMACs - // truncated to as many bits as the beacon's `length` parameter; e.g. - // aws_dbe_b_inspector_id_last4 = truncate(HMAC("4321"), 10) - // aws_dbe_b_unit = truncate(HMAC("123456789012"), 30) + // 6. Create the DynamoDb Encryption configuration for the table we will be writing to. + // The beaconVersions are added to the search configuration. + let table_config = DynamoDbTableEncryptionConfig::builder() + .logical_table_name(ddb_table_name) + .partition_key_name("work_id") + .sort_key_name("inspection_date") + .attribute_actions_on_encrypt(attribute_actions_on_encrypt) + .keyring(kms_keyring) + .search( + SearchConfig::builder() + .write_version(1) // MUST be 1 + .versions(beacon_versions) + .build()?, + ) + .build()?; - let item = HashMap::from([ - ( - "work_id".to_string(), - AttributeValue::S("1313ba89-5661-41eb-ba6c-cb1b4cb67b2d".to_string()), - ), - ( - "inspection_date".to_string(), - AttributeValue::S("2023-06-13".to_string()), - ), - ( - "inspector_id_last4".to_string(), - AttributeValue::S("4321".to_string()), - ), - ( - "unit".to_string(), - AttributeValue::S("123456789012".to_string()), - ), - ]); + let table_configs = DynamoDbTablesEncryptionConfig::builder() + .table_encryption_configs(HashMap::from([(ddb_table_name.to_string(), table_config)])) + .build()?; - ddb.put_item() - .table_name(ddb_table_name) - .set_item(Some(item.clone())) - .send() - .await?; + // 7. Create a new AWS SDK DynamoDb client using the TableEncryptionConfigs + let sdk_config = aws_config::load_defaults(aws_config::BehaviorVersion::latest()).await; + let dynamo_config = aws_sdk_dynamodb::config::Builder::from(&sdk_config) + .interceptor(DbEsdkInterceptor::new(table_configs)?) + .build(); + let ddb = aws_sdk_dynamodb::Client::from_conf(dynamo_config); - // 9. Query for the item we just put. - // Note that we are constructing the query as if we were querying on plaintext values. - // However, the DDB encryption client will detect that this attribute name has a beacon configured. - // The client will add the beaconized attribute name and attribute value to the query, - // and transform the query to use the beaconized name and value. - // Internally, the client will query for and receive all items with a matching HMAC value in the beacon field. - // This may include a number of "false positives" with different ciphertext, but the same truncated HMAC. - // e.g. if truncate(HMAC("123456789012"), 30) - // == truncate(HMAC("098765432109"), 30), - // the query will return both items. - // The client will decrypt all returned items to determine which ones have the expected attribute values, - // and only surface items with the correct plaintext to the user. - // This procedure is internal to the client and is abstracted away from the user; - // e.g. the user will only see "123456789012" and never - // "098765432109", though the actual query returned both. - let expression_attributes_names = HashMap::from([ - ("#last4".to_string(), "inspector_id_last4".to_string()), - ("#unit".to_string(), "unit".to_string()), - ]); + // 8. Put an item into our table using the above client. + // Before the item gets sent to DynamoDb, it will be encrypted + // client-side, according to our configuration. + // Since our configuration includes beacons for `inspector_id_last4` and `unit`, + // the client will add two additional attributes to the item. These attributes will have names + // `aws_dbe_b_inspector_id_last4` and `aws_dbe_b_unit`. Their values will be HMACs + // truncated to as many bits as the beacon's `length` parameter; e.g. + // aws_dbe_b_inspector_id_last4 = truncate(HMAC("4321"), 10) + // aws_dbe_b_unit = truncate(HMAC("123456789012"), 30) - let expression_attribute_values = HashMap::from([ - (":last4".to_string(), AttributeValue::S("4321".to_string())), - ( - ":unit".to_string(), - AttributeValue::S("123456789012".to_string()), - ), - ]); + let item = HashMap::from([ + ( + "work_id".to_string(), + AttributeValue::S("1313ba89-5661-41eb-ba6c-cb1b4cb67b2d".to_string()), + ), + ( + "inspection_date".to_string(), + AttributeValue::S("2023-06-13".to_string()), + ), + ( + "inspector_id_last4".to_string(), + AttributeValue::S("4321".to_string()), + ), + ( + "unit".to_string(), + AttributeValue::S("123456789012".to_string()), + ), + ]); - // GSIs do not update instantly - // so if the results come back empty - // we retry after a short sleep - for _i in 0..10 { - let query_response = ddb - .query() + ddb.put_item() .table_name(ddb_table_name) - .index_name(GSI_NAME) - .key_condition_expression("#last4 = :last4 and #unit = :unit") - .set_expression_attribute_names(Some(expression_attributes_names.clone())) - .set_expression_attribute_values(Some(expression_attribute_values.clone())) + .set_item(Some(item.clone())) .send() .await?; - // if no results, sleep and try again - if query_response.items.is_none() || query_response.items.as_ref().unwrap().is_empty() { - std::thread::sleep(std::time::Duration::from_millis(20)); - continue; - } + // 9. Query for the item we just put. + // Note that we are constructing the query as if we were querying on plaintext values. + // However, the DDB encryption client will detect that this attribute name has a beacon configured. + // The client will add the beaconized attribute name and attribute value to the query, + // and transform the query to use the beaconized name and value. + // Internally, the client will query for and receive all items with a matching HMAC value in the beacon field. + // This may include a number of "false positives" with different ciphertext, but the same truncated HMAC. + // e.g. if truncate(HMAC("123456789012"), 30) + // == truncate(HMAC("098765432109"), 30), + // the query will return both items. + // The client will decrypt all returned items to determine which ones have the expected attribute values, + // and only surface items with the correct plaintext to the user. + // This procedure is internal to the client and is abstracted away from the user; + // e.g. the user will only see "123456789012" and never + // "098765432109", though the actual query returned both. + let expression_attributes_names = HashMap::from([ + ("#last4".to_string(), "inspector_id_last4".to_string()), + ("#unit".to_string(), "unit".to_string()), + ]); + + let expression_attribute_values = HashMap::from([ + (":last4".to_string(), AttributeValue::S("4321".to_string())), + ( + ":unit".to_string(), + AttributeValue::S("123456789012".to_string()), + ), + ]); - let attribute_values = query_response.items.unwrap(); - // Validate only 1 item was returned: the item we just put - assert_eq!(attribute_values.len(), 1); - let returned_item = &attribute_values[0]; - // Validate the item has the expected attributes - assert_eq!( - returned_item["inspector_id_last4"], - AttributeValue::S("4321".to_string()) - ); - assert_eq!( - returned_item["unit"], - AttributeValue::S("123456789012".to_string()) - ); - break; - } - println!("basic_searchable_encryption successful."); - Ok(()) + // GSIs do not update instantly + // so if the results come back empty + // we retry after a short sleep + for _i in 0..10 { + let query_response = ddb + .query() + .table_name(ddb_table_name) + .index_name(GSI_NAME) + .key_condition_expression("#last4 = :last4 and #unit = :unit") + .set_expression_attribute_names(Some(expression_attributes_names.clone())) + .set_expression_attribute_values(Some(expression_attribute_values.clone())) + .send() + .await?; + + // if no results, sleep and try again + if query_response.items.is_none() || query_response.items.as_ref().unwrap().is_empty() { + std::thread::sleep(std::time::Duration::from_millis(20)); + continue; + } + + let attribute_values = query_response.items.unwrap(); + // Validate only 1 item was returned: the item we just put + assert_eq!(attribute_values.len(), 1); + let returned_item = &attribute_values[0]; + // Validate the item has the expected attributes + assert_eq!( + returned_item["inspector_id_last4"], + AttributeValue::S("4321".to_string()) + ); + assert_eq!( + returned_item["unit"], + AttributeValue::S("123456789012".to_string()) + ); + break; + } + println!("basic_searchable_encryption successful."); + Ok(()) + }; + future.await } diff --git a/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/beacon_styles_searchable_encryption.rs b/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/beacon_styles_searchable_encryption.rs index 45701af7b..a287c9ecb 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/beacon_styles_searchable_encryption.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/beacon_styles_searchable_encryption.rs @@ -12,13 +12,13 @@ use aws_db_esdk::dynamodb::types::SearchConfig; use aws_db_esdk::dynamodb::types::SingleKeyStore; use aws_db_esdk::dynamodb::types::StandardBeacon; use aws_db_esdk::dynamodb::types::*; -use aws_db_esdk::CryptoAction; +use aws_db_esdk::intercept::DbEsdkInterceptor; use aws_db_esdk::key_store::client as keystore_client; use aws_db_esdk::key_store::types::key_store_config::KeyStoreConfig; use aws_db_esdk::key_store::types::KmsConfiguration; use aws_db_esdk::material_providers::client as mpl_client; use aws_db_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; -use aws_db_esdk::intercept::DbEsdkInterceptor; +use aws_db_esdk::CryptoAction; use aws_db_esdk::DynamoDbTablesEncryptionConfig; use aws_sdk_dynamodb::types::AttributeValue; use std::collections::HashMap; diff --git a/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/complexexample/beacon_config.rs b/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/complexexample/beacon_config.rs index 39adb19be..913004d97 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/complexexample/beacon_config.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/complexexample/beacon_config.rs @@ -12,13 +12,13 @@ use aws_db_esdk::dynamodb::types::SearchConfig; use aws_db_esdk::dynamodb::types::SignedPart; use aws_db_esdk::dynamodb::types::SingleKeyStore; use aws_db_esdk::dynamodb::types::StandardBeacon; -use aws_db_esdk::CryptoAction; +use aws_db_esdk::intercept::DbEsdkInterceptor; use aws_db_esdk::key_store::client as keystore_client; use aws_db_esdk::key_store::types::key_store_config::KeyStoreConfig; use aws_db_esdk::key_store::types::KmsConfiguration; use aws_db_esdk::material_providers::client as mpl_client; use aws_db_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; -use aws_db_esdk::intercept::DbEsdkInterceptor; +use aws_db_esdk::CryptoAction; use aws_db_esdk::DynamoDbTablesEncryptionConfig; use std::collections::HashMap; diff --git a/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/compound_beacon_searchable_encryption.rs b/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/compound_beacon_searchable_encryption.rs index 9246dcc4e..8b2f2b733 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/compound_beacon_searchable_encryption.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/compound_beacon_searchable_encryption.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::test_utils; +use aws_db_esdk::client as transform_client; use aws_db_esdk::dynamodb::types::BeaconKeySource; use aws_db_esdk::dynamodb::types::BeaconVersion; use aws_db_esdk::dynamodb::types::CompoundBeacon; @@ -10,14 +11,13 @@ use aws_db_esdk::dynamodb::types::EncryptedPart; use aws_db_esdk::dynamodb::types::SearchConfig; use aws_db_esdk::dynamodb::types::SingleKeyStore; use aws_db_esdk::dynamodb::types::StandardBeacon; -use aws_db_esdk::CryptoAction; +use aws_db_esdk::intercept::DbEsdkInterceptor; use aws_db_esdk::key_store::client as keystore_client; use aws_db_esdk::key_store::types::key_store_config::KeyStoreConfig; use aws_db_esdk::key_store::types::KmsConfiguration; use aws_db_esdk::material_providers::client as mpl_client; use aws_db_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; -use aws_db_esdk::client as transform_client; -use aws_db_esdk::intercept::DbEsdkInterceptor; +use aws_db_esdk::CryptoAction; use aws_db_esdk::DynamoDbTablesEncryptionConfig; use aws_sdk_dynamodb::types::AttributeValue; use std::collections::HashMap; diff --git a/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/virtual_beacon_searchable_encryption.rs b/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/virtual_beacon_searchable_encryption.rs index a324534ce..d558f3a2e 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/virtual_beacon_searchable_encryption.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/searchableencryption/virtual_beacon_searchable_encryption.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::test_utils; +use aws_db_esdk::client as transform_client; use aws_db_esdk::dynamodb::types::BeaconKeySource; use aws_db_esdk::dynamodb::types::BeaconVersion; use aws_db_esdk::dynamodb::types::DynamoDbTableEncryptionConfig; @@ -12,14 +13,13 @@ use aws_db_esdk::dynamodb::types::StandardBeacon; use aws_db_esdk::dynamodb::types::VirtualField; use aws_db_esdk::dynamodb::types::VirtualPart; use aws_db_esdk::dynamodb::types::VirtualTransform; -use aws_db_esdk::CryptoAction; +use aws_db_esdk::intercept::DbEsdkInterceptor; use aws_db_esdk::key_store::client as keystore_client; use aws_db_esdk::key_store::types::key_store_config::KeyStoreConfig; use aws_db_esdk::key_store::types::KmsConfiguration; use aws_db_esdk::material_providers::client as mpl_client; use aws_db_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; -use aws_db_esdk::client as transform_client; -use aws_db_esdk::intercept::DbEsdkInterceptor; +use aws_db_esdk::CryptoAction; use aws_db_esdk::DynamoDbTablesEncryptionConfig; use aws_sdk_dynamodb::types::AttributeValue; use std::collections::HashMap; diff --git a/DynamoDbEncryption/runtimes/rust/src/intercept.rs b/DynamoDbEncryption/runtimes/rust/src/intercept.rs index 5300ef35b..f45942135 100644 --- a/DynamoDbEncryption/runtimes/rust/src/intercept.rs +++ b/DynamoDbEncryption/runtimes/rust/src/intercept.rs @@ -5,11 +5,12 @@ #![deny(nonstandard_style)] #![deny(clippy::all)] #![allow(unused)] +#![allow(clippy::result_large_err)] use aws_sdk_dynamodb::{ config::{ - ConfigBag, Intercept, RuntimeComponents, interceptors::{BeforeSerializationInterceptorContextMut, FinalizerInterceptorContextMut}, + ConfigBag, Intercept, RuntimeComponents, }, error::BoxError, }; diff --git a/DynamoDbEncryption/runtimes/rust/src/lib.rs b/DynamoDbEncryption/runtimes/rust/src/lib.rs index 06c086eec..c1dfc5af1 100644 --- a/DynamoDbEncryption/runtimes/rust/src/lib.rs +++ b/DynamoDbEncryption/runtimes/rust/src/lib.rs @@ -2,26 +2,26 @@ // SPDX-License-Identifier: Apache-2.0 //! The AWS Database Encryption SDK provides client side encryption for DynamoDB. -//! +//! //! The journey starts with a configuration. //! For details see the [Examples](https://github.com/aws/aws-database-encryption-sdk-dynamodb/tree/main/releases/rust/db_esdk/examples) //! or the [Developer Guide](https://docs.aws.amazon.com/database-encryption-sdk/latest/devguide) -//! +//! //! The examples below will use an empty configuration for brevity. //! This is not something you would do in actual use. -//! +//! //! There are two modes of operation. -//! +//! //! ## DynamoDB Client with Interceptor //! By far the most common mode is to add our interceptor to your DynamoDB client. -//! +//! //! Once you've created your augmented DynamoDB Client, use it as you normally would. //! Values are automatically encrypted on Put and decrypted on Get. -//! +//! //! If configured, Scan Beacons are generated to allow [Searchable Encryption](https://docs.aws.amazon.com/database-encryption-sdk/latest/devguide/searchable-encryption.html) -//! +//! //! [See full example](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/releases/rust/db_esdk/examples/basic_get_put_example.rs) -//! +//! //! ```text //! let table_configs = DynamoDbTablesEncryptionConfig::builder() //! .table_encryption_configs(HashMap::new()) // your configuration here @@ -31,25 +31,25 @@ //! let dynamo_config = aws_sdk_dynamodb::config::Builder::from(&sdk_config) //! .interceptor(DbEsdkInterceptor::new(table_configs)?) //! .build(); -//! +//! //! let ddb_client = aws_sdk_dynamodb::Client::from_conf(dynamo_config); //! ``` -//! +//! //! ## Item Encryptor -//! +//! //! Rather than letting things happen automatically, you can manually encrypt //! and decrypt individual DynamoDB Items. //! This does NOT allow for [Searchable Encryption](https://docs.aws.amazon.com/database-encryption-sdk/latest/devguide/searchable-encryption.html). -//! +//! //! [See full example](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/releases/rust/db_esdk/examples/itemencryptor/item_encrypt_decrypt.rs) -//! +//! //! ```text //! let config = DynamoDbItemEncryptorConfig::builder() //! // your configuration here //! .build()?; -//! +//! //! let item_encryptor = enc_client::Client::from_conf(config)?; -//! +//! //! let encrypted_item = item_encryptor //! .encrypt_item() //! .plaintext_item(original_item) @@ -57,7 +57,7 @@ //! .await? //! .encrypted_item //! .unwrap(); -//! +//! //! let decrypted_item = item_encryptor //! .decrypt_item() //! .encrypted_item(encrypted_item) @@ -65,7 +65,7 @@ //! .await? //! .encrypted_item //! .unwrap(); -//! +//! //! assert_eq!(decrypted_item, original_item); //! ``` //! @@ -79,15 +79,12 @@ pub mod client; /// Errors and error handling utilities. pub mod error; +/// the DbEsdkInterceptor type for use with the aws_sdk_dynamodb interceptor +pub mod intercept; /// All the transform operations. Rarely useful. pub mod operation; /// Types for the transform client. Rarely useful. pub mod types; -/// the DbEsdkInterceptor type for use with the aws_sdk_dynamodb interceptor -pub mod intercept; - -#[cfg(feature = "wrapped-client")] -pub mod wrapped; pub use client::Client; pub use types::dynamo_db_tables_encryption_config::DynamoDbTablesEncryptionConfig; @@ -96,12 +93,12 @@ pub use types::dynamo_db_tables_encryption_config::DynamoDbTablesEncryptionConfi pub use crate::deps::aws_cryptography_dbEncryptionSdk_dynamoDb as dynamodb; /// Low level interface to encrypt or decrypt individual Items. pub use crate::deps::aws_cryptography_dbEncryptionSdk_dynamoDb_itemEncryptor as item_encryptor; +pub(crate) use crate::deps::aws_cryptography_dbEncryptionSdk_structuredEncryption; +pub use crate::deps::aws_cryptography_dbEncryptionSdk_structuredEncryption::types::CryptoAction; /// Branch key support. See [Key Stores](https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/keystores.html) pub use crate::deps::aws_cryptography_keyStore as key_store; /// [Key Rings](https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/choose-keyring.html) and other fundamentals. pub use crate::deps::aws_cryptography_materialProviders as material_providers; -pub(crate) use crate::deps::aws_cryptography_dbEncryptionSdk_structuredEncryption; -pub use crate::deps::aws_cryptography_dbEncryptionSdk_structuredEncryption::types::CryptoAction; /// Rarely needed internal KMS Client, needed for [ClientSupplier](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/releases/rust/db_esdk/examples/clientsupplier/regional_role_client_supplier.rs) pub use crate::deps::com_amazonaws_kms; @@ -127,9 +124,9 @@ pub(crate) use crate::implementation_from_dafny::HMAC; pub(crate) use crate::implementation_from_dafny::UTF8; pub(crate) use crate::implementation_from_dafny::UUID; -pub(crate) mod validation; pub(crate) mod conversions; pub(crate) mod deps; +pub(crate) mod validation; pub(crate) mod aes_gcm; pub(crate) mod aes_kdf_ctr; diff --git a/DynamoDbEncryption/runtimes/rust/src/software_externs.rs b/DynamoDbEncryption/runtimes/rust/src/software_externs.rs index e5461844c..f0a77646a 100644 --- a/DynamoDbEncryption/runtimes/rust/src/software_externs.rs +++ b/DynamoDbEncryption/runtimes/rust/src/software_externs.rs @@ -24,7 +24,7 @@ pub mod software { pub mod legacy { use crate::software::amazon::cryptography::dbencryptionsdk::dynamodb::itemencryptor::internaldafny::types::Error as DafnyError; use crate::software::amazon::cryptography::dbencryptionsdk::dynamodb::internaldafny::types::LegacyPolicy; - use ::std::rc::Rc; + use ::dafny_runtime::Rc; type Legacy = ::dafny_runtime::Object; fn error(s: &str) -> Rc { diff --git a/DynamoDbEncryption/runtimes/rust/start_release.sh b/DynamoDbEncryption/runtimes/rust/start_release.sh index 7a0d88ca3..921fbd36c 100755 --- a/DynamoDbEncryption/runtimes/rust/start_release.sh +++ b/DynamoDbEncryption/runtimes/rust/start_release.sh @@ -17,16 +17,26 @@ if [ $MATCHES -eq 0 ]; then exit 1 fi +echo +echo +echo "Current Dafny Version:" +dafny --version +echo +echo +sleep 2 + # Update the version in Cargo.toml perl -pe "s/^version = .*$/version = \"$1\"/" < Cargo.toml > new_Cargo.toml mv new_Cargo.toml Cargo.toml +set -v + # Remove all files and directories in src except for specified files find src -depth 1 | egrep -v '(intercept.rs|lib.rs|software_externs.rs|README)' | xargs rm -rf # Change to the parent directory and run make polymorph and transpile commands cd ../.. -make polymorph_rust transpile_rust test_rust +make polymorph_rust transpile_rust test_rust test_rust_debug # Remove target directory cd runtimes/rust @@ -43,13 +53,26 @@ cd ../../../releases/rust/db_esdk git checkout dafny_runtime_rust # Remove unnecessary files and directories -rm -rf *~ copy_externs.sh start_release.sh test_published.sh test_examples *.pem RELEASE.md src/README.md +rm -rf *~ copy_externs.sh upgrade_examples.sh start_release.sh test_published.sh test_examples *.pem RELEASE.md src/README.md # Create .gitignore file with specified entries echo Cargo.lock > .gitignore echo target >> .gitignore +# format the generated code +cargo fmt + +# clippy shuld run clean +cargo clippy +cargo clippy --example main + +# replace local path with latest dafny-runtime from crates.io +cargo rm dafny_runtime +cargo add dafny-runtime -F sync + # Run cargo test and example tests +cargo test --release +cargo run --release --example main cargo test cargo run --example main diff --git a/DynamoDbEncryption/runtimes/rust/test_examples/Cargo.toml b/DynamoDbEncryption/runtimes/rust/test_examples/Cargo.toml index 5a41ebcba..9a766105c 100644 --- a/DynamoDbEncryption/runtimes/rust/test_examples/Cargo.toml +++ b/DynamoDbEncryption/runtimes/rust/test_examples/Cargo.toml @@ -6,16 +6,16 @@ rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -aws-config = "1.5.10" -aws-lc-rs = "1.11.1" -aws-lc-sys = "0.24.0" -aws-sdk-dynamodb = "1.54.0" -aws-sdk-kms = "1.50.0" +aws-config = "1.5.15" +aws-lc-rs = "1.12.2" +aws-lc-sys = "0.25.0" +aws-sdk-dynamodb = "1.62.0" +aws-sdk-kms = "1.57.0" aws-smithy-runtime-api = {version = "1.7.3", features = ["client"] } -aws-smithy-types = "1.2.9" -chrono = "0.4.38" +aws-smithy-types = "1.2.12" +chrono = "0.4.39" dafny-runtime = "0.1.1" dashmap = "6.1.0" pem = "3.0.4" -tokio = {version = "1.41.1", features = ["full"] } -uuid = { version = "1.11.0", features = ["v4"] } +tokio = {version = "1.43.0", features = ["full"] } +uuid = { version = "1.12.1", features = ["v4"] } diff --git a/DynamoDbEncryption/runtimes/rust/upgrade_examples.sh b/DynamoDbEncryption/runtimes/rust/upgrade_examples.sh new file mode 100755 index 000000000..54325e32f --- /dev/null +++ b/DynamoDbEncryption/runtimes/rust/upgrade_examples.sh @@ -0,0 +1,7 @@ +#!/bin/bash -eu + +rm -rf test_examples/src +cp -r examples test_examples/src/ +cd test_examples +cargo upgrade +rm -rf src diff --git a/TestVectors/runtimes/rust/Cargo.toml b/TestVectors/runtimes/rust/Cargo.toml index 5a440c1e3..3b632b1d7 100644 --- a/TestVectors/runtimes/rust/Cargo.toml +++ b/TestVectors/runtimes/rust/Cargo.toml @@ -7,17 +7,17 @@ rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -aws-config = "1.5.11" -aws-lc-rs = "1.12.0" -aws-lc-sys = "0.24.0" -aws-sdk-dynamodb = "1.56.0" -aws-sdk-kms = "1.52.0" +aws-config = "1.5.15" +aws-lc-rs = "1.12.2" +aws-lc-sys = "0.25.0" +aws-sdk-dynamodb = "1.62.0" +aws-sdk-kms = "1.57.0" aws-smithy-runtime-api = {version = "1.7.3", features = ["client"] } -aws-smithy-types = "1.2.10" +aws-smithy-types = "1.2.12" chrono = "0.4.39" cpu-time = "1.0.0" -dafny_runtime = { path = "../../../submodules/MaterialProviders/smithy-dafny/TestModels/dafny-dependencies/dafny_runtime_rust"} +dafny_runtime = { path = "../../../submodules/smithy-dafny/TestModels/dafny-dependencies/dafny_runtime_rust", features = ["sync"] } dashmap = "6.1.0" pem = "3.0.4" -tokio = {version = "1.42.0", features = ["full"] } -uuid = { version = "1.11.0", features = ["v4"] } +tokio = {version = "1.43.0", features = ["full"] } +uuid = { version = "1.12.1", features = ["v4"] } diff --git a/TestVectors/runtimes/rust/src/create_client.rs b/TestVectors/runtimes/rust/src/create_client.rs index b4f7b477f..951659264 100644 --- a/TestVectors/runtimes/rust/src/create_client.rs +++ b/TestVectors/runtimes/rust/src/create_client.rs @@ -1,7 +1,7 @@ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -use std::rc::Rc; +use dafny_runtime::Rc; use dafny_runtime::Object; use crate::implementation_from_dafny::software::amazon::cryptography::services::dynamodb::internaldafny::types::IDynamoDBClient; use crate::implementation_from_dafny::software::amazon::cryptography::dbencryptionsdk::dynamodb::internaldafny::types::Error; @@ -39,7 +39,7 @@ impl _CreateInterceptedDDBClient_Compile::_default { let client = crate::deps::com_amazonaws_dynamodb::client::Client { inner }; let dafny_client = ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(client)); - std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::Success { + Rc::new(crate::r#_Wrappers_Compile::Result::Success { value: dafny_client, }) } @@ -56,7 +56,7 @@ impl _CreateInterceptedDDBClient_Compile::_default { let inner = aws_sdk_dynamodb::Client::new(&shared_config); let client = crate::deps::com_amazonaws_dynamodb::client::Client { inner }; let dafny_client = ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(client)); - std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::Success { + Rc::new(crate::r#_Wrappers_Compile::Result::Success { value: dafny_client, }) } diff --git a/releases/rust/db_esdk/dafny_runtime_rust/Cargo.toml b/releases/rust/db_esdk/dafny_runtime_rust/Cargo.toml index 92c31d457..ac3e72c39 100644 --- a/releases/rust/db_esdk/dafny_runtime_rust/Cargo.toml +++ b/releases/rust/db_esdk/dafny_runtime_rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dafny-runtime" -version = "0.1.1" +version = "0.2.0" edition = "2021" keywords = ["dafny"] license = "ISC AND (Apache-2.0 OR ISC)" @@ -13,3 +13,6 @@ readme = "README.md" once_cell = "1.18.0" num = "0.4" itertools = "0.11.0" + +[features] +sync = [] diff --git a/releases/rust/db_esdk/dafny_runtime_rust/src/lib.rs b/releases/rust/db_esdk/dafny_runtime_rust/src/lib.rs index fc267756b..1598acc51 100644 --- a/releases/rust/db_esdk/dafny_runtime_rust/src/lib.rs +++ b/releases/rust/db_esdk/dafny_runtime_rust/src/lib.rs @@ -6,23 +6,29 @@ pub use mem::MaybeUninit; use num::{bigint::ParseBigIntError, Integer, Num, One, Signed}; pub use once_cell::unsync::Lazy; use std::{ - any::Any, borrow::Borrow, boxed::Box, - cell::{RefCell, UnsafeCell}, clone::Clone, cmp::Ordering, collections::{HashMap, HashSet}, convert::From, fmt::{Debug, Display, Formatter}, hash::{Hash, Hasher}, - ptr::NonNull, mem, ops::{Add, Deref, Div, Fn, Mul, Neg, Rem, Sub}, - rc::{Rc, Weak}, + ptr::NonNull, vec::Vec, }; +#[cfg(not(feature = "sync"))] +pub use ::std::{ + cell::RefCell, + rc::{Rc, Weak}, +}; + +#[cfg(feature = "sync")] +pub use ::std::sync::{Arc as Rc, Mutex as RefCell, Weak}; + pub use system::*; pub use itertools; @@ -34,12 +40,58 @@ pub use num::ToPrimitive; pub use num::Zero; pub use std::convert::Into; +pub use ::std::any::Any; +pub use ::std::marker::Send; +pub use ::std::marker::Sync; + +#[cfg(not(feature = "sync"))] +pub type DynAny = dyn Any; +#[cfg(feature = "sync")] +pub type DynAny = dyn Any + Send + Sync; + +#[cfg(not(feature = "sync"))] +pub use ::std::cell::UnsafeCell; + +#[cfg(feature = "sync")] +pub struct UnsafeCell { + data: ::std::cell::UnsafeCell, // UnsafeCell for interior mutability +} +// SAFETY: UnsafeCell is not possibly sync normally. +// However, we use it only for raw pointers, and fields and access to read and write +// to fields will be subject to mutexes in any cases. +#[cfg(feature = "sync")] +unsafe impl Sync for UnsafeCell where T: Send {} +#[cfg(feature = "sync")] +impl UnsafeCell { + pub fn new(data: T) -> Self { + UnsafeCell { + data: ::std::cell::UnsafeCell::new(data), + } + } +} +#[cfg(feature = "sync")] +impl UnsafeCell { + pub fn get(&self) -> *mut T { + ::std::cell::UnsafeCell::get(&self.data) + } + pub fn raw_get(this: *const UnsafeCell) -> *mut T { + unsafe { ::std::cell::UnsafeCell::raw_get(&(*this).data) } + } +} + // An atomic box is just a RefCell in Rust pub type SizeT = usize; +#[cfg(not(feature = "sync"))] pub trait DafnyType: Clone + DafnyPrint + 'static {} +#[cfg(feature = "sync")] +pub trait DafnyType: Clone + DafnyPrint + Send + Sync + 'static {} +#[cfg(not(feature = "sync"))] impl DafnyType for T where T: Clone + DafnyPrint + 'static {} +#[cfg(feature = "sync")] +impl DafnyType for T where T: Clone + DafnyPrint + Send + Sync + 'static {} + pub trait DafnyTypeEq: DafnyType + Hash + Eq {} impl DafnyTypeEq for T where T: DafnyType + Hash + Eq {} @@ -64,12 +116,14 @@ pub mod dafny_runtime_conversions { use num::BigInt; use num::ToPrimitive; - use std::collections::HashMap; - use std::collections::HashSet; - use std::hash::Hash; - use std::rc::Rc; + use ::std::collections::HashMap; + use ::std::collections::HashSet; + use ::std::hash::Hash; + + pub use super::Rc; pub mod object { + pub use super::Rc; pub type DafnyClass = crate::Object; pub type DafnyArray = crate::Object<[T]>; pub type DafnyArray2 = crate::Object>; @@ -82,7 +136,7 @@ pub mod dafny_runtime_conversions { pub fn dafny_class_to_boxed_struct(ptr: DafnyClass) -> Box { Box::new(dafny_class_to_struct(ptr)) } - pub unsafe fn dafny_class_to_rc_struct(ptr: DafnyClass) -> ::std::rc::Rc { + pub unsafe fn dafny_class_to_rc_struct(ptr: DafnyClass) -> Rc { crate::rcmut::to_rc(ptr.0.unwrap()) } pub fn struct_to_dafny_class(t: T) -> DafnyClass { @@ -91,7 +145,7 @@ pub mod dafny_runtime_conversions { pub fn boxed_struct_to_dafny_class(t: Box) -> DafnyClass { struct_to_dafny_class(*t) } - pub unsafe fn rc_struct_to_dafny_class(t: ::std::rc::Rc) -> DafnyClass { + pub unsafe fn rc_struct_to_dafny_class(t: Rc) -> DafnyClass { crate::Object::from_rc(t) } // Conversions to and from Dafny arrays. They all take ownership @@ -100,9 +154,7 @@ pub mod dafny_runtime_conversions { } pub fn vec_to_dafny_array(array: Vec) -> DafnyArray { // SAFETY: We own the array - unsafe { - crate::Object::from_rc(::std::rc::Rc::from(array.into_boxed_slice())) - } + unsafe { crate::Object::from_rc(Rc::from(array.into_boxed_slice())) } } pub unsafe fn dafny_array2_to_vec(ptr: DafnyArray2) -> Vec> { crate::rd!(ptr).to_vec() @@ -110,6 +162,7 @@ pub mod dafny_runtime_conversions { } pub mod ptr { + pub use super::Rc; pub type DafnyClass = crate::Ptr; pub type DafnyArray = crate::Ptr<[T]>; pub type DafnyArray2 = crate::Ptr>; @@ -576,7 +629,7 @@ impl DafnyInt { #[inline] pub fn parse_bytes(number: &[u8], radix: u32) -> DafnyInt { DafnyInt { - data: ::std::rc::Rc::new(BigInt::parse_bytes(number, radix).unwrap()), + data: Rc::new(BigInt::parse_bytes(number, radix).unwrap()), } } pub fn from_usize(usize: usize) -> DafnyInt { @@ -597,7 +650,7 @@ macro_rules! impl_dafnyint_from { impl ::std::convert::From<$type> for $crate::DafnyInt { fn from(n: $type) -> Self { $crate::DafnyInt { - data: ::std::rc::Rc::new(n.into()), + data: $crate::Rc::new(n.into()), } } } @@ -690,10 +743,10 @@ where values: Rc>, }, ConcatSequence { - left: Rc>>, - right: Rc>>, + left: Rc>>, + right: Rc>>, length: SizeT, - boxed: Rc>>>>, + cache: Rc>>>>, }, } @@ -704,70 +757,58 @@ where pub fn from_array(values: Ptr<[T]>) -> Sequence { let mut v = vec![]; v.extend_from_slice(read!(values)); - Sequence::ArraySequence { - values: Rc::new(v), - } + Sequence::ArraySequence { values: Rc::new(v) } } pub fn from_array_object(values: &Object<[T]>) -> Sequence { let mut v = vec![]; v.extend_from_slice(rd!(values)); - Sequence::ArraySequence { - values: Rc::new(v), - } + Sequence::ArraySequence { values: Rc::new(v) } } pub fn from_array_slice(values: Ptr<[T]>, start: &DafnyInt, end: &DafnyInt) -> Sequence { let mut v = vec![]; v.extend_from_slice(&read!(values)[start.to_usize().unwrap()..end.to_usize().unwrap()]); - Sequence::ArraySequence { - values: Rc::new(v), - } + Sequence::ArraySequence { values: Rc::new(v) } } - pub fn from_array_slice_object(values: &Object<[T]>, start: &DafnyInt, end: &DafnyInt) -> Sequence { + pub fn from_array_slice_object( + values: &Object<[T]>, + start: &DafnyInt, + end: &DafnyInt, + ) -> Sequence { let mut v = vec![]; v.extend_from_slice(&rd!(values)[start.to_usize().unwrap()..end.to_usize().unwrap()]); - Sequence::ArraySequence { - values: Rc::new(v), - } + Sequence::ArraySequence { values: Rc::new(v) } } pub fn from_array_take(values: Ptr<[T]>, n: &DafnyInt) -> Sequence { let mut v = vec![]; v.extend_from_slice(&read!(values)[..n.to_usize().unwrap()]); - Sequence::ArraySequence { - values: Rc::new(v), - } + Sequence::ArraySequence { values: Rc::new(v) } } pub fn from_array_take_object(values: &Object<[T]>, n: &DafnyInt) -> Sequence { let mut v = vec![]; v.extend_from_slice(&rd!(values)[..n.to_usize().unwrap()]); - Sequence::ArraySequence { - values: Rc::new(v), - } + Sequence::ArraySequence { values: Rc::new(v) } } pub fn from_array_drop(values: Ptr<[T]>, n: &DafnyInt) -> Sequence { let mut v = vec![]; v.extend_from_slice(&read!(values)[n.to_usize().unwrap()..]); - Sequence::ArraySequence { - values: Rc::new(v), - } + Sequence::ArraySequence { values: Rc::new(v) } } pub fn from_array_drop_object(values: &Object<[T]>, n: &DafnyInt) -> Sequence { let mut v = vec![]; v.extend_from_slice(&rd!(values)[n.to_usize().unwrap()..]); - Sequence::ArraySequence { - values: Rc::new(v), - } + Sequence::ArraySequence { values: Rc::new(v) } } pub fn from_array_owned(values: Vec) -> Sequence { Sequence::ArraySequence { values: Rc::new(values), } } - pub fn new_concat_sequence(left: &Sequence, right: &Sequence) -> Sequence { + pub(crate) fn new_concat_sequence(left: &Sequence, right: &Sequence) -> Sequence { Sequence::ConcatSequence { - left: Rc::new(UnsafeCell::new(left.clone())), - right: Rc::new(UnsafeCell::new(right.clone())), + left: Rc::new(RefCell::new(left.clone())), + right: Rc::new(RefCell::new(right.clone())), length: left.cardinality_usize() + right.cardinality_usize(), - boxed: Rc::new(RefCell::new(None)), + cache: Rc::new(RefCell::new(None)), } } pub fn to_array(&self) -> Rc> { @@ -780,33 +821,81 @@ where } Sequence::ConcatSequence { length, - boxed, + cache, left, right, } => { - let into_boxed = boxed.as_ref().clone(); - let into_boxed_borrowed = into_boxed.borrow(); - let borrowed: Option<&Rc>> = into_boxed_borrowed.as_ref(); - if let Some(cache) = borrowed.as_ref() { - return Rc::clone(cache); + #[cfg(feature = "sync")] + { + let guard = cache.as_ref().lock().unwrap(); + let cache_borrow: Option<&Rc>> = guard.as_ref(); + if let Some(cache) = cache_borrow { + return Rc::clone(cache); + } + } + + #[cfg(not(feature = "sync"))] + { + let cache_opened = cache.as_ref().clone(); + let cache_opened_borrowed = cache_opened.borrow(); + let cache_borrow: Option<&Rc>> = cache_opened_borrowed.as_ref(); + if let Some(cache) = cache_borrow { + return Rc::clone(cache); + } } // Let's create an array of size length and fill it up recursively // We don't materialize nested arrays because most of the time they are forgotten let mut array: Vec = Vec::with_capacity(*length); - Sequence::::append_recursive(&mut array, self); + Sequence::::append_recursive_safe(&mut array, &None, left, right); let result = Rc::new(array); - let mut cache = boxed.borrow_mut(); - let mutable_left: *mut Sequence = left.get(); - let mutable_right: *mut Sequence = right.get(); - // safety: Once the array is computed, left and right won't ever be read again. - unsafe { *mutable_left = seq!() }; - unsafe { *mutable_right = seq!() }; - *cache = Some(result.clone()); + #[cfg(not(feature = "sync"))] + { + *left.borrow_mut() = seq!(); + *right.borrow_mut() = seq!(); + } + #[cfg(feature = "sync")] + { + let mut left_guard = left.as_ref().lock().unwrap(); + let mut right_guard = right.as_ref().lock().unwrap(); + *left_guard = seq!(); + *right_guard = seq!(); + } + #[cfg(not(feature = "sync"))] + let mut guard = cache.borrow_mut(); + #[cfg(feature = "sync")] + let mut guard = cache.as_ref().lock().unwrap(); + *guard = Some(result.clone()); result } } } + pub fn append_recursive_safe( + array: &mut Vec, + cache_borrow: &Option<&Rc>>, + left: &Rc>>, + right: &Rc>>, + ) { + if let Some(values) = cache_borrow.as_ref() { + for value in values.iter() { + array.push(value.clone()); + } + return; + } + #[cfg(not(feature = "sync"))] + { + Sequence::::append_recursive(array, &left.as_ref().borrow()); + Sequence::::append_recursive(array, &right.as_ref().borrow()); + } + #[cfg(feature = "sync")] + { + let left_guard = left.as_ref().lock().unwrap(); + let right_guard = right.as_ref().lock().unwrap(); + Sequence::::append_recursive(array, &left_guard); + Sequence::::append_recursive(array, &right_guard); + } + } + pub fn append_recursive(array: &mut Vec, this: &Sequence) { match this { Sequence::ArraySequence { values, .. } => @@ -817,27 +906,30 @@ where } } Sequence::ConcatSequence { - boxed, left, right, .. + cache: boxed, left, right, .. } => // Let's create an array of size length and fill it up recursively { + #[cfg(feature = "sync")] + let into_boxed = boxed.as_ref(); + #[cfg(feature = "sync")] + let into_boxed_borrowed = into_boxed; + #[cfg(feature = "sync")] + let guard = into_boxed_borrowed.lock().unwrap(); + #[cfg(feature = "sync")] + let borrowed: Option<&Rc>> = guard.as_ref(); + + #[cfg(not(feature = "sync"))] let into_boxed = boxed.as_ref().clone(); + #[cfg(not(feature = "sync"))] let into_boxed_borrowed = into_boxed.borrow(); + #[cfg(not(feature = "sync"))] let borrowed: Option<&Rc>> = into_boxed_borrowed.as_ref(); - if let Some(values) = borrowed.as_ref() { - for value in values.iter() { - array.push(value.clone()); - } - return; - } - // safety: When a concat is initialized, the left and right are well defined - Sequence::::append_recursive(array, unsafe { &mut *left.get() }); - Sequence::::append_recursive(array, unsafe { &mut *right.get() }); + Self::append_recursive_safe(array, &borrowed, left, right); } } } - /// Returns the cardinality of this [`Sequence`]. - // The cardinality returns the length of the sequence + /// Returns the cardinality or length of this [`Sequence`]. pub fn cardinality_usize(&self) -> SizeT { match self { Sequence::ArraySequence { values, .. } => @@ -1204,7 +1296,6 @@ impl Map { } } - impl Map { pub fn values(&self) -> Set { let mut result: Vec = Vec::new(); @@ -1735,9 +1826,10 @@ impl Multiset { } pub fn iter(&self) -> impl Iterator + '_ { - self.data.iter().flat_map( - |(k, &ref v)| - ::std::iter::repeat(k).take(v.clone().as_usize())).cloned() + self.data + .iter() + .flat_map(|(k, &ref v)| ::std::iter::repeat(k).take(v.clone().as_usize())) + .cloned() } } @@ -1837,14 +1929,6 @@ pub fn dafny_rational_to_int(r: &BigRational) -> BigInt { euclidian_division(r.numer().clone(), r.denom().clone()) } -pub fn nullable_referential_equality(left: Option>, right: Option>) -> bool { - match (left, right) { - (Some(l), Some(r)) => Rc::ptr_eq(&l, &r), - (None, None) => true, - _ => false, - } -} - pub fn euclidian_division(a: A, b: A) -> A { if !a.is_negative() { if !b.is_negative() { @@ -1989,16 +2073,29 @@ impl DafnyPrint for LazyFieldWrapper { } } +#[cfg(feature = "sync")] // Convert the DafnyPrint above into a macro so that we can create it for functions of any input arity macro_rules! dafny_print_function { ($($n:tt)*) => { - impl $crate::DafnyPrint for ::std::rc::Rc B> { + impl $crate::DafnyPrint for $crate::Rc B + Send + Sync> { fn fmt_print(&self, f: &mut ::std::fmt::Formatter<'_>, _in_seq: bool) -> ::std::fmt::Result { write!(f, "") } } } } +#[cfg(not(feature = "sync"))] +// Convert the DafnyPrint above into a macro so that we can create it for functions of any input arity +macro_rules! dafny_print_function { + ($($n:tt)*) => { + impl $crate::DafnyPrint for $crate::Rc B> { + fn fmt_print(&self, f: &mut ::std::fmt::Formatter<'_>, _in_seq: bool) -> ::std::fmt::Result { + write!(f, "") + } + } + } +} + // Now create a loop like impl_tuple_print_loop so that we can create functions up to size 32 macro_rules! dafny_print_function_loop { ($first:ident $($rest:ident)*) => { @@ -2038,16 +2135,6 @@ impl Display for DafnyPrintWrapper<&T> { } } -// from gazebo -#[inline] -pub unsafe fn transmute_unchecked(x: A) -> B { - assert_eq!(std::mem::size_of::(), std::mem::size_of::()); - debug_assert_eq!(0, (&x as *const A).align_offset(std::mem::align_of::())); - let b = std::ptr::read(&x as *const A as *const B); - std::mem::forget(x); - b -} - pub trait DafnyPrint { fn fmt_print(&self, f: &mut Formatter<'_>, in_seq: bool) -> std::fmt::Result; @@ -2067,7 +2154,11 @@ impl DafnyPrint for *const T { macro_rules! impl_print_display { ($name:ty) => { impl $crate::DafnyPrint for $name { - fn fmt_print(&self, f: &mut ::std::fmt::Formatter<'_>, _in_seq: bool) -> ::std::fmt::Result { + fn fmt_print( + &self, + f: &mut ::std::fmt::Formatter<'_>, + _in_seq: bool, + ) -> ::std::fmt::Result { ::std::fmt::Display::fmt(&self, f) } } @@ -2106,7 +2197,7 @@ impl DafnyPrint for () { } } -#[derive(Clone)] +#[derive(Clone, Copy)] pub struct DafnyCharUTF16(pub u16); pub type DafnyStringUTF16 = Sequence; @@ -2182,7 +2273,7 @@ impl Sub for DafnyCharUTF16 { } } -#[derive(Clone)] +#[derive(Clone, Copy)] pub struct DafnyChar(pub char); pub type DafnyString = Sequence; @@ -2336,7 +2427,13 @@ impl DafnyPrint for BigRational { } } -impl DafnyPrint for Rc { +impl DafnyPrint for Rc { + fn fmt_print(&self, f: &mut Formatter<'_>, in_seq: bool) -> std::fmt::Result { + self.as_ref().fmt_print(f, in_seq) + } +} + +impl DafnyPrint for &Rc { fn fmt_print(&self, f: &mut Formatter<'_>, in_seq: bool) -> std::fmt::Result { self.as_ref().fmt_print(f, in_seq) } @@ -2368,12 +2465,20 @@ impl DafnyPrint for Vec { } } +#[cfg(not(feature = "sync"))] impl DafnyPrint for RefCell { fn fmt_print(&self, f: &mut Formatter<'_>, _in_seq: bool) -> std::fmt::Result { self.borrow().fmt_print(f, _in_seq) } } +#[cfg(feature = "sync")] +impl DafnyPrint for RefCell { + fn fmt_print(&self, f: &mut Formatter<'_>, _in_seq: bool) -> std::fmt::Result { + self.lock().unwrap().fmt_print(f, _in_seq) + } +} + impl DafnyPrint for HashSet { fn fmt_print(&self, f: &mut Formatter<'_>, _in_seq: bool) -> std::fmt::Result { write!(f, "{{")?; @@ -2540,7 +2645,7 @@ macro_rules! ARRAY_GETTER_LENGTH0 { pub fn length0_usize(&self) -> usize { self.data.len() } - } + }; } macro_rules! ARRAY_GETTER_LENGTH { ($field: ident, $field_usize: ident) => { @@ -2552,7 +2657,7 @@ macro_rules! ARRAY_GETTER_LENGTH { pub fn $field_usize(&self) -> usize { self.$field } - } + }; } // An 1-dimensional Dafny array is a zero-cost abstraction over a pointer on a native array @@ -2566,7 +2671,7 @@ macro_rules! array { macro_rules! ARRAY_INIT { {$length: ident, $inner: expr} => { $crate::array::initialize_box_usize($length, { - ::std::rc::Rc::new(move |_| { $inner }) + $crate::Rc::new(move |_| { $inner }) }) } } @@ -2574,7 +2679,7 @@ macro_rules! ARRAY_INIT { macro_rules! ARRAY_INIT_INNER { ($length: ident) => { $crate::array::placebos_box_usize::($length) - } + }; } // ARRAY_DATA_TYPE(length0, length1, length2) will return @@ -2657,7 +2762,6 @@ macro_rules! ARRAY_METHODS { }; } - macro_rules! ARRAY_STRUCT { ($ArrayType:ident, $length0: ident, $($length:ident),+) => { pub struct $ArrayType { @@ -2763,25 +2867,25 @@ macro_rules! ARRAY_DEF { // Array2 to Array16 -ARRAY_DEF!{Array2, +ARRAY_DEF! {Array2, (length0, length0_usize), (length1, length1_usize) } -ARRAY_DEF!{Array3, +ARRAY_DEF! {Array3, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize) } -ARRAY_DEF!{Array4, +ARRAY_DEF! {Array4, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), (length3, length3_usize) } -ARRAY_DEF!{Array5, +ARRAY_DEF! {Array5, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2789,7 +2893,7 @@ ARRAY_DEF!{Array5, (length4, length4_usize) } -ARRAY_DEF!{Array6, +ARRAY_DEF! {Array6, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2798,7 +2902,7 @@ ARRAY_DEF!{Array6, (length5, length5_usize) } -ARRAY_DEF!{Array7, +ARRAY_DEF! {Array7, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2808,7 +2912,7 @@ ARRAY_DEF!{Array7, (length6, length6_usize) } -ARRAY_DEF!{Array8, +ARRAY_DEF! {Array8, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2819,7 +2923,7 @@ ARRAY_DEF!{Array8, (length7, length7_usize) } -ARRAY_DEF!{Array9, +ARRAY_DEF! {Array9, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2831,7 +2935,7 @@ ARRAY_DEF!{Array9, (length8, length8_usize) } -ARRAY_DEF!{Array10, +ARRAY_DEF! {Array10, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2844,7 +2948,7 @@ ARRAY_DEF!{Array10, (length9, length9_usize) } -ARRAY_DEF!{Array11, +ARRAY_DEF! {Array11, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2858,7 +2962,7 @@ ARRAY_DEF!{Array11, (length10, length10_usize) } -ARRAY_DEF!{Array12, +ARRAY_DEF! {Array12, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2873,7 +2977,7 @@ ARRAY_DEF!{Array12, (length11, length11_usize) } -ARRAY_DEF!{Array13, +ARRAY_DEF! {Array13, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2889,7 +2993,7 @@ ARRAY_DEF!{Array13, (length12, length12_usize) } -ARRAY_DEF!{Array14, +ARRAY_DEF! {Array14, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2906,7 +3010,7 @@ ARRAY_DEF!{Array14, (length13, length13_usize) } -ARRAY_DEF!{Array15, +ARRAY_DEF! {Array15, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2924,7 +3028,7 @@ ARRAY_DEF!{Array15, (length14, length14_usize) } -ARRAY_DEF!{Array16, +ARRAY_DEF! {Array16, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2945,10 +3049,12 @@ ARRAY_DEF!{Array16, pub mod array { use super::DafnyInt; - use num::ToPrimitive; - use std::mem::MaybeUninit; - use std::{boxed::Box, rc::Rc, vec::Vec}; use super::Ptr; + use super::Rc; + use ::std::boxed::Box; + use ::std::mem::MaybeUninit; + use ::std::vec::Vec; + use num::ToPrimitive; #[inline] pub fn from_native(v: Box<[T]>) -> Ptr<[T]> { @@ -3113,7 +3219,7 @@ macro_rules! is_object { #[macro_export] macro_rules! cast_any { ($raw:expr) => { - $crate::Upcast::::upcast($crate::read!($raw)) + $crate::Upcast::<$crate::DynAny>::upcast($crate::read!($raw)) }; } // cast_any_object is meant to be used on references only, to convert any references (classes or traits)* @@ -3121,11 +3227,10 @@ macro_rules! cast_any { #[macro_export] macro_rules! cast_any_object { ($obj:expr) => { - $crate::UpcastObject::::upcast($crate::md!($obj)) + $crate::UpcastObject::<$crate::DynAny>::upcast($crate::md!($obj)) }; } - // When initializing an uninitialized field for the first time, // we ensure we don't drop the previous content // This is problematic if the same field is overwritten multiple times @@ -3161,25 +3266,22 @@ macro_rules! update_nodrop { // Given a class or array pointer, transforms it to a mutable reference #[macro_export] macro_rules! modify { - ($ptr:expr) => { - { - #[allow(unused_unsafe)] - let tmp = unsafe {&mut *(::std::cell::UnsafeCell::raw_get($ptr.0.unwrap_unchecked().as_ptr()))}; - tmp - } - } + ($ptr:expr) => {{ + #[allow(unused_unsafe)] + let tmp = + unsafe { &mut *($crate::UnsafeCell::raw_get($ptr.0.unwrap_unchecked().as_ptr())) }; + tmp + }}; } // Given a class or array pointer, transforms it to a read-only reference #[macro_export] macro_rules! read { - ($ptr:expr) => { - { - #[allow(unused_unsafe)] - let tmp = unsafe {&*(::std::cell::UnsafeCell::raw_get($ptr.0.unwrap_unchecked().as_ptr()))}; - tmp - } - } + ($ptr:expr) => {{ + #[allow(unused_unsafe)] + let tmp = unsafe { &*($crate::UnsafeCell::raw_get($ptr.0.unwrap_unchecked().as_ptr())) }; + tmp + }}; } // If the field is guaranteed to be assigned only once, update_field_nodrop is sufficient @@ -3243,7 +3345,13 @@ macro_rules! update_field_mut_if_uninit { // This Ptr has the same run-time space as *mut pub struct Ptr(pub Option>>); -impl Ptr { +#[cfg(feature = "sync")] +unsafe impl Send for Ptr {} + +#[cfg(feature = "sync")] +unsafe impl Sync for Ptr {} + +impl Ptr { pub fn null() -> Self { Ptr(None) } @@ -3252,7 +3360,12 @@ impl Ptr { } #[inline] pub fn from_raw_nonnull(t: *mut T) -> Ptr { - unsafe { Ptr(Some(::std::mem::transmute::, NonNull>>(NonNull::new_unchecked(t)))) } + unsafe { + Ptr(Some(::std::mem::transmute::< + NonNull, + NonNull>, + >(NonNull::new_unchecked(t)))) + } } pub fn from_box(t: Box) -> Ptr { Self::from_raw_nonnull(Box::into_raw(t)) @@ -3266,12 +3379,12 @@ impl Ptr { } } -impl > Ptr { +impl> Ptr { pub fn is_instance_of(self) -> bool { if self.is_null() { false } else { - read!(Upcast::::upcast(read!(self))) + read!(Upcast::::upcast(read!(self))) .downcast_ref::() .is_some() } @@ -3285,13 +3398,12 @@ impl NontrivialDefault for Ptr { } } -impl Ptr { +impl Ptr { pub fn new(val: T) -> Ptr { Self::from_box(Box::new(val)) } } - impl Eq for Ptr {} impl Clone for Ptr { @@ -3300,9 +3412,9 @@ impl Clone for Ptr { } } -impl Copy for Ptr { } +impl Copy for Ptr {} -impl Default for Ptr { +impl Default for Ptr { fn default() -> Self { Ptr::null() } @@ -3313,22 +3425,22 @@ impl Debug for Ptr { self.fmt_print(f, false) } } -impl DafnyPrint for Ptr { +impl DafnyPrint for Ptr { fn fmt_print(&self, f: &mut Formatter<'_>, _in_seq: bool) -> std::fmt::Result { write!(f, "") } } - -impl PartialEq> for Ptr { +impl PartialEq> for Ptr { fn eq(&self, other: &Ptr) -> bool { if !self.is_null() { if !other.is_null() { // To compare addresses, we need to ensure we only compare thin pointers // https://users.rust-lang.org/t/comparing-addresses-between-fat-and-thin-pointers/89008 ::std::ptr::eq( - self.clone().into_raw() as *const (), - other.clone().into_raw() as *const ()) + self.clone().into_raw() as *const (), + other.clone().into_raw() as *const (), + ) } else { false } @@ -3340,7 +3452,7 @@ impl PartialEq> for Ptr { } } -impl std::hash::Hash for Ptr { +impl std::hash::Hash for Ptr { fn hash(&self, state: &mut H) { if !self.is_null() { (read!(self.clone()) as *const T as *const ()).hash(state); @@ -3350,44 +3462,39 @@ impl std::hash::Hash for Ptr { } } -impl AsMut for Ptr { +impl AsMut for Ptr { fn as_mut(&mut self) -> &mut T { modify!(self.clone()) } } -impl AsRef for Ptr { +impl AsRef for Ptr { fn as_ref(&self) -> &T { read!(self.clone()) } } -impl Ptr { +impl Ptr { // Never use on local values, only on &self types previously called on Ptr types. pub fn from_ref(r: &T) -> Ptr { - Ptr(unsafe {::std::mem::transmute::<_, Option>>>(r as *const T)}) + Ptr(unsafe { ::std::mem::transmute::<_, Option>>>(r as *const T) }) } } // cast is meant to be used on references only, to downcast a trait reference to a class reference #[macro_export] macro_rules! cast { - ($raw:expr, $id:ty) => { - { - #[allow(unused_unsafe)] - let tmp = - unsafe { - let expr = $raw; - let res: $crate::Ptr<$id> = - if expr.is_null() { - $crate::Ptr::null() - } else { - $crate::Ptr::from_raw_nonnull(expr.into_raw() as *mut $id) - }; - res - }; - tmp - } - }; - + ($raw:expr, $id:ty) => {{ + #[allow(unused_unsafe)] + let tmp = unsafe { + let expr = $raw; + let res: $crate::Ptr<$id> = if expr.is_null() { + $crate::Ptr::null() + } else { + $crate::Ptr::from_raw_nonnull(expr.into_raw() as *mut $id) + }; + res + }; + tmp + }}; } ///////////////// @@ -3396,7 +3503,7 @@ macro_rules! cast { pub struct Object(pub Option>); -impl Object { +impl Object { // For safety, it requires the Rc to have been created with Rc::new() pub unsafe fn from_rc(rc: Rc) -> Object { Object(Some(rcmut::from_rc(rc))) @@ -3408,15 +3515,15 @@ impl Object { self.0.is_none() } } -impl > Object { +impl> Object { pub fn is_instance_of(self) -> bool { - // safety: Dafny won't call this function unless it can guarantee the object is still allocated - rd!(UpcastObject::::upcast(rd!(self))) + // safety: Dafny won't call this function unless it can guarantee the object is still allocated + rd!(UpcastObject::::upcast(rd!(self))) .downcast_ref::() .is_some() } } -impl Object { +impl Object { pub fn new(val: T) -> Object { Object(Some(rcmut::new(val))) } @@ -3429,20 +3536,20 @@ impl Clone for Object { } } -impl Default for Object { +impl Default for Object { fn default() -> Self { Object(None) } } -impl> Debug for Object { +impl> Debug for Object { fn fmt(&self, f: &mut Formatter) -> std::fmt::Result { self.fmt_print(f, false) } } -impl > DafnyPrint for Object { +impl> DafnyPrint for Object { fn fmt_print(&self, f: &mut Formatter<'_>, _in_seq: bool) -> std::fmt::Result { - let obj_any = UpcastObject::::upcast(self.as_ref()); + let obj_any = UpcastObject::::upcast(self.as_ref()); let option_string = obj_any.as_ref().downcast_ref::(); match option_string { Some(s) => write!(f, "{}", s), @@ -3451,20 +3558,19 @@ impl > DafnyPrint for Object { } } -impl DafnyPrint for Object<[T]> { +impl DafnyPrint for Object<[T]> { fn fmt_print(&self, f: &mut Formatter<'_>, _in_seq: bool) -> std::fmt::Result { write!(f, "") } } - -impl UpcastObject for String { - fn upcast(&self) -> Object { +impl UpcastObject for String { + fn upcast(&self) -> Object { // SAFETY: RC was just created - unsafe { Object::from_rc(Rc::new(self.clone()) as Rc) } + unsafe { Object::from_rc(Rc::new(self.clone()) as Rc) } } } -impl PartialEq> for Object { +impl PartialEq> for Object { fn eq(&self, other: &Object) -> bool { if let Some(p) = &self.0 { if let Some(q) = &other.0 { @@ -3482,7 +3588,7 @@ impl PartialEq> for Object { } } -impl std::hash::Hash for Object { +impl std::hash::Hash for Object { fn hash(&self, state: &mut H) { if let Some(p) = &self.0 { (p.as_ref().get() as *const ()).hash(state); @@ -3492,12 +3598,12 @@ impl std::hash::Hash for Object { } } -impl AsMut for Object { +impl AsMut for Object { fn as_mut(&mut self) -> &mut T { unsafe { &mut *(&self.0).as_ref().unwrap_unchecked().as_ref().get() } } } -impl AsRef for Object { +impl AsRef for Object { fn as_ref(&self) -> &T { unsafe { &*(&self.0).as_ref().unwrap_unchecked().as_ref().get() } } @@ -3509,11 +3615,11 @@ fn increment_strong_count(data: *const T) { // SAFETY: This method is called only on values that were constructed from an Rc unsafe { // Black box avoids the compiler wrongly inferring that increment strong count does nothing since the data it was applied to can be traced to be borrowed - ::std::hint::black_box(Rc::increment_strong_count(data)); + ::std::hint::black_box(Rc::increment_strong_count(data)); } } -impl Object { +impl Object { // SAFETY: This function needs to be called from a reference obtained by calling read!(o) on an object // We never inline this function, otherwise the compiler might figure out a way to remove the increment_strong_count #[inline(never)] @@ -3534,9 +3640,9 @@ impl Object { macro_rules! cast_object { ($raw:expr, $id:ty) => { unsafe { - let res: $crate::Object<$id> = - $crate::Object(Some(::std::rc::Rc::from_raw( - ::std::rc::Rc::into_raw($raw.0.unwrap()) as _))); + let res: $crate::Object<$id> = $crate::Object(Some($crate::Rc::from_raw( + $crate::Rc::into_raw($raw.0.unwrap()) as _, + ))); res } }; @@ -3548,12 +3654,25 @@ pub fn allocate_object() -> Object { } pub struct AllocationTracker { - allocations: Vec> + allocations: Vec>, } +#[cfg(feature = "sync")] +pub fn allocate_object_track( + allocation_tracker: &mut AllocationTracker, +) -> Object { + let res = allocate_object::(); + allocation_tracker + .allocations + .push(Rc::>::downgrade(&res.0.clone().unwrap())); + res +} +#[cfg(not(feature = "sync"))] pub fn allocate_object_track(allocation_tracker: &mut AllocationTracker) -> Object { let res = allocate_object::(); - allocation_tracker.allocations.push(Rc::>::downgrade(&res.0.clone().unwrap())); + allocation_tracker + .allocations + .push(Rc::>::downgrade(&res.0.clone().unwrap())); res } @@ -3561,7 +3680,10 @@ pub fn allocate_object_track(allocation_tracker: &mut AllocationTrac #[macro_export] macro_rules! update_field_nodrop_object { ($ptr:expr, $field: ident, $value:expr) => { - $crate::update_nodrop_object!(($crate::rcmut::borrow_mut(&mut $ptr.0.clone().unwrap())).$field, $value) + $crate::update_nodrop_object!( + ($crate::rcmut::borrow_mut(&mut $ptr.0.clone().unwrap())).$field, + $value + ) }; } @@ -3569,7 +3691,12 @@ macro_rules! update_field_nodrop_object { #[macro_export] macro_rules! update_field_mut_nodrop_object { ($ptr:expr, $field: ident, $value:expr) => { - unsafe { ($crate::rcmut::borrow_mut(&mut $ptr.0.clone().unwrap())).$field.get().write($value) } + unsafe { + ($crate::rcmut::borrow_mut(&mut $ptr.0.clone().unwrap())) + .$field + .get() + .write($value) + } }; } @@ -3637,7 +3764,6 @@ macro_rules! update_field_mut_uninit_object { }}; } - // Equivalent of modify but for rcmut #[macro_export] macro_rules! md { @@ -3657,24 +3783,20 @@ macro_rules! rd { // To use when modifying a mutable field that is wrapped with UnsafeCell #[macro_export] macro_rules! modify_field { - ($pointer:expr, $rhs:expr) => { - { - let lhs = $pointer.get(); - let rhs = $rhs; - unsafe {*lhs = rhs} - } - }; + ($pointer:expr, $rhs:expr) => {{ + let lhs = $pointer.get(); + let rhs = $rhs; + unsafe { *lhs = rhs } + }}; } // To use when reading a mutable field that is wrapped with UnsafeCell #[macro_export] macro_rules! read_field { - ($pointer:expr) => { - { + ($pointer:expr) => {{ let lhs = $pointer.get(); - unsafe {(*lhs).clone()} - } - }; + unsafe { (*lhs).clone() } + }}; } pub type Field = UnsafeCell; @@ -3686,33 +3808,31 @@ pub fn new_field(t: T) -> Field { #[macro_export] macro_rules! refcount { ($x:expr) => { - ::std::rc::Rc::strong_count(unsafe { $crate::rcmut::as_rc($x.0.as_ref().unwrap()) }) + $crate::Rc::strong_count(unsafe { $crate::rcmut::as_rc($x.0.as_ref().unwrap()) }) }; } pub mod object { - use std::any::Any; + use crate::{Any, DynAny}; + + pub fn downcast(_self: crate::Object) -> crate::Object { + super::cast_object!(_self, T) + } pub fn new(val: T) -> crate::Object { crate::Object(Some(crate::rcmut::new(val))) } - pub fn downcast(_self: crate::Object) -> crate::Object { - unsafe { - crate::Object(Some(crate::rcmut::downcast::(_self.0.unwrap()).unwrap())) // Use unwrap_unchecked? - } - } #[inline] - pub fn is(_self: crate::Object) -> bool { + pub fn is(_self: crate::Object) -> bool { is_object!(_self, T) } } // Inspired from https://crates.io/crates/rcmut pub mod rcmut { - use std::cell::UnsafeCell; - use std::mem::{self, MaybeUninit}; - use std::rc::Rc; - use std::sync::Arc; + use crate::Rc; + use crate::UnsafeCell; + use ::std::mem::{self, MaybeUninit}; pub fn array_object_from_rc(data: Rc<[T]>) -> crate::Object<[T]> { crate::Object(Some(unsafe { crate::rcmut::from_rc(data) })) @@ -3774,54 +3894,20 @@ pub mod rcmut { mem::transmute(this.get()) } - pub unsafe fn downcast(this: RcMut) -> Option> { - let t: Rc = to_rc(this); + #[cfg(feature = "sync")] + pub unsafe fn downcast( + this: RcMut, + ) -> Option> { + let t: Rc = to_rc(this); let t: Rc = Rc::downcast::(t).ok()?; mem::transmute(t) } - /// A reference counted smart pointer with unrestricted mutability. - pub struct ArcMut { - inner: Arc>, - } - - impl Clone for ArcMut { - fn clone(&self) -> ArcMut { - ArcMut { - inner: self.inner.clone(), - } - } - } - - impl ArcMut { - /// Create a new ArcMut for a value. - pub fn new(val: T) -> ArcMut { - ArcMut { - inner: Arc::new(UnsafeCell::new(val)), - } - } - } - - impl ArcMut { - /// Retrieve the inner Rc as a reference. - pub unsafe fn as_arc(&self) -> &Arc { - mem::transmute(&self.inner) - } - - /// Retrieve the inner Rc as a mutable reference. - pub unsafe fn as_arc_mut(&mut self) -> &mut Arc { - mem::transmute(&mut self.inner) - } - - /// Get a reference to the value. - pub unsafe fn borrow(&self) -> &T { - mem::transmute(self.inner.get()) - } - - /// Get a mutable reference to the value. - pub unsafe fn borrow_mut(&mut self) -> &mut T { - mem::transmute(self.inner.get()) - } + #[cfg(not(feature = "sync"))] + pub unsafe fn downcast(this: RcMut) -> Option> { + let t: Rc = to_rc(this); + let t: Rc = Rc::downcast::(t).ok()?; + mem::transmute(t) } } @@ -3882,30 +3968,33 @@ macro_rules! maybe_placebos_from { //////////////// pub fn upcast_object() -> Rc) -> Object> - where A : UpcastObject +where + A: UpcastObject, { Rc::new(|x: Object| x.as_ref().upcast()) } pub fn upcast() -> Rc) -> Ptr> - where A: Upcast +where + A: Upcast, { Rc::new(|x: Ptr| read!(x).upcast()) } pub fn upcast_box() -> Rc Box> - where A: UpcastBox +where + A: UpcastBox, { Rc::new(|x: A| UpcastBox::upcast(&x)) } pub fn upcast_box_box() -> Rc) -> Box> - where Box: UpcastBox +where + Box: UpcastBox, { Rc::new(|x: Box| UpcastBox::upcast(&x)) } -pub fn upcast_id() -> Rc A> -{ +pub fn upcast_id() -> Rc A> { Rc::new(|x: A| x) } @@ -3917,8 +4006,8 @@ pub fn box_coerce(f: Box U>) -> Box( - a_to_r: Rc R + 'static>) -> - Rc A>) -> Rc R> + 'static> { + a_to_r: Rc R + 'static>, +) -> Rc A>) -> Rc R> + 'static> { Rc::new(move |t_to_a: Rc A>| { let a_to_r = a_to_r.clone(); let t_to_a = t_to_a.clone(); @@ -3934,12 +4023,12 @@ pub trait Upcast { pub trait UpcastObject { fn upcast(&self) -> Object; } -impl Upcast for T { +impl Upcast for T { fn upcast(&self) -> Ptr { Ptr::from_raw_nonnull(self as *const T as *mut T) } } -impl UpcastObject for T { +impl UpcastObject for T { fn upcast(&self) -> Object { Object::from_ref(self) } @@ -3950,7 +4039,6 @@ pub trait UpcastBox { fn upcast(&self) -> Box; } - #[macro_export] macro_rules! Extends { ($traitType: tt) => { @@ -4006,8 +4094,7 @@ macro_rules! UpcastDefObject { } // Coercions for sets -impl Set -{ +impl Set { pub fn coerce(f: Rc V>) -> Rc) -> Set> { Rc::new(move |x: Set| { // We need to upcast individual elements @@ -4022,8 +4109,7 @@ impl Set } // Coercions for sequences -impl Sequence -{ +impl Sequence { pub fn coerce(f: Rc V>) -> Rc) -> Sequence> { // We need to upcast individual elements Rc::new(move |x: Sequence| { @@ -4038,12 +4124,13 @@ impl Sequence } // Coercions for multisets -impl Multiset -{ - pub fn coerce(f: Rc V>) -> Rc) -> Multiset> { +impl Multiset { + pub fn coerce( + f: Rc V>, + ) -> Rc) -> Multiset> { // We need to upcast individual elements Rc::new(move |x: Multiset| { - let f2 = f.clone(); + let f2 = f.clone(); // We need to upcast individual elements let mut new_multiset: HashMap = HashMap::::default(); for (value, count) in x.data.into_iter() { @@ -4055,8 +4142,7 @@ impl Multiset } // Coercions for Maps -impl Map -{ +impl Map { pub fn coerce(f: Rc V>) -> Rc) -> Map> { // We need to upcast individual elements Rc::new(move |x: Map| { @@ -4068,4 +4154,4 @@ impl Map Map::from_hashmap_owned(new_map) }) } -} \ No newline at end of file +} diff --git a/releases/rust/db_esdk/dafny_runtime_rust/src/system/mod.rs b/releases/rust/db_esdk/dafny_runtime_rust/src/system/mod.rs index c530be0a5..582b3cc82 100644 --- a/releases/rust/db_esdk/dafny_runtime_rust/src/system/mod.rs +++ b/releases/rust/db_esdk/dafny_runtime_rust/src/system/mod.rs @@ -1,3771 +1,4003 @@ #![allow(warnings, unconditional_panic)] #![allow(nonstandard_style)] +#![cfg_attr(any(), rustfmt::skip)] pub mod _System { - pub use crate::DafnyInt; - pub use crate::DafnyType; - pub use ::std::fmt::Debug; - pub use ::std::fmt::Formatter; - pub use ::std::fmt::Result; - pub use crate::DafnyPrint; - pub use ::std::rc::Rc; - pub use ::std::cmp::Eq; - pub use ::std::hash::Hash; - pub use ::std::hash::Hasher; - pub use ::std::default::Default; - pub use ::std::convert::AsRef; - pub use crate::SequenceIter; - pub use crate::seq; - - pub type nat = DafnyInt; - - #[derive(PartialEq, Clone)] - pub enum Tuple2 { - _T2 { - _0: T0, - _1: T1 - } - } - - impl Tuple2 { - pub fn _0(&self) -> &T0 { - match self { - Tuple2::_T2{_0, _1, } => _0, - } - } - pub fn _1(&self) -> &T1 { - match self { - Tuple2::_T2{_0, _1, } => _1, - } - } - } - - impl Debug - for Tuple2 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple2 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple2::_T2{_0, _1, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_1, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple2 { - pub fn coerce(f_0: Rc r#__T0 + 'static>, f_1: Rc r#__T1 + 'static>) -> Rc) -> Tuple2> { - Rc::new(move |this: Self| -> Tuple2{ - match this { - Tuple2::_T2{_0, _1, } => { - Tuple2::_T2 { - _0: f_0.clone()(_0), - _1: f_1.clone()(_1) - } - }, - } - }) - } - } - - impl Eq - for Tuple2 {} - - impl Hash - for Tuple2 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple2::_T2{_0, _1, } => { - Hash::hash(_0, _state); - Hash::hash(_1, _state) - }, - } - } - } - - impl Default - for Tuple2 { - fn default() -> Tuple2 { - Tuple2::_T2 { - _0: Default::default(), - _1: Default::default() - } - } - } - - impl AsRef> - for Tuple2 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple0 { - _T0 {} - } - - impl Tuple0 {} - - impl Debug - for Tuple0 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple0 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple0::_T0{} => { - write!(_formatter, "")?; - Ok(()) - }, - } - } - } - - impl Tuple0 { - pub fn _AllSingletonConstructors() -> SequenceIter> { - seq![Rc::new(Tuple0::_T0 {})].iter() - } - } - - impl Eq - for Tuple0 {} - - impl Hash - for Tuple0 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple0::_T0{} => { - - }, - } - } - } - - impl Default - for Tuple0 { - fn default() -> Tuple0 { - Tuple0::_T0 {} - } - } - - impl AsRef - for Tuple0 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple1 { - _T1 { - _0: T0 - } - } - - impl Tuple1 { - pub fn _0(&self) -> &T0 { - match self { - Tuple1::_T1{_0, } => _0, - } - } - } - - impl Debug - for Tuple1 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple1 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple1::_T1{_0, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple1 { - pub fn coerce(f_0: Rc r#__T0 + 'static>) -> Rc) -> Tuple1> { - Rc::new(move |this: Self| -> Tuple1{ - match this { - Tuple1::_T1{_0, } => { - Tuple1::_T1 { - _0: f_0.clone()(_0) - } - }, - } - }) - } - } - - impl Eq - for Tuple1 {} - - impl Hash - for Tuple1 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple1::_T1{_0, } => { - Hash::hash(_0, _state) - }, - } - } - } - - impl Default - for Tuple1 { - fn default() -> Tuple1 { - Tuple1::_T1 { - _0: Default::default() - } - } - } - - impl AsRef> - for Tuple1 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple3 { - _T3 { - _0: T0, - _1: T1, - _2: T2 - } - } - - impl Tuple3 { - pub fn _0(&self) -> &T0 { - match self { - Tuple3::_T3{_0, _1, _2, } => _0, - } - } - pub fn _1(&self) -> &T1 { - match self { - Tuple3::_T3{_0, _1, _2, } => _1, - } - } - pub fn _2(&self) -> &T2 { - match self { - Tuple3::_T3{_0, _1, _2, } => _2, - } - } - } - - impl Debug - for Tuple3 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple3 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple3::_T3{_0, _1, _2, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_1, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_2, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple3 { - pub fn coerce(f_0: Rc r#__T0 + 'static>, f_1: Rc r#__T1 + 'static>, f_2: Rc r#__T2 + 'static>) -> Rc) -> Tuple3> { - Rc::new(move |this: Self| -> Tuple3{ - match this { - Tuple3::_T3{_0, _1, _2, } => { - Tuple3::_T3 { - _0: f_0.clone()(_0), - _1: f_1.clone()(_1), - _2: f_2.clone()(_2) - } - }, - } - }) - } - } - - impl Eq - for Tuple3 {} - - impl Hash - for Tuple3 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple3::_T3{_0, _1, _2, } => { - Hash::hash(_0, _state); - Hash::hash(_1, _state); - Hash::hash(_2, _state) - }, - } - } - } - - impl Default - for Tuple3 { - fn default() -> Tuple3 { - Tuple3::_T3 { - _0: Default::default(), - _1: Default::default(), - _2: Default::default() - } - } - } - - impl AsRef> - for Tuple3 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple4 { - _T4 { - _0: T0, - _1: T1, - _2: T2, - _3: T3 - } - } - - impl Tuple4 { - pub fn _0(&self) -> &T0 { - match self { - Tuple4::_T4{_0, _1, _2, _3, } => _0, - } - } - pub fn _1(&self) -> &T1 { - match self { - Tuple4::_T4{_0, _1, _2, _3, } => _1, - } - } - pub fn _2(&self) -> &T2 { - match self { - Tuple4::_T4{_0, _1, _2, _3, } => _2, - } - } - pub fn _3(&self) -> &T3 { - match self { - Tuple4::_T4{_0, _1, _2, _3, } => _3, - } - } - } - - impl Debug - for Tuple4 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple4 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple4::_T4{_0, _1, _2, _3, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_1, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_2, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_3, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple4 { - pub fn coerce(f_0: Rc r#__T0 + 'static>, f_1: Rc r#__T1 + 'static>, f_2: Rc r#__T2 + 'static>, f_3: Rc r#__T3 + 'static>) -> Rc) -> Tuple4> { - Rc::new(move |this: Self| -> Tuple4{ - match this { - Tuple4::_T4{_0, _1, _2, _3, } => { - Tuple4::_T4 { - _0: f_0.clone()(_0), - _1: f_1.clone()(_1), - _2: f_2.clone()(_2), - _3: f_3.clone()(_3) - } - }, - } - }) - } - } - - impl Eq - for Tuple4 {} - - impl Hash - for Tuple4 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple4::_T4{_0, _1, _2, _3, } => { - Hash::hash(_0, _state); - Hash::hash(_1, _state); - Hash::hash(_2, _state); - Hash::hash(_3, _state) - }, - } - } - } - - impl Default - for Tuple4 { - fn default() -> Tuple4 { - Tuple4::_T4 { - _0: Default::default(), - _1: Default::default(), - _2: Default::default(), - _3: Default::default() - } - } - } - - impl AsRef> - for Tuple4 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple5 { - _T5 { - _0: T0, - _1: T1, - _2: T2, - _3: T3, - _4: T4 - } - } - - impl Tuple5 { - pub fn _0(&self) -> &T0 { - match self { - Tuple5::_T5{_0, _1, _2, _3, _4, } => _0, - } - } - pub fn _1(&self) -> &T1 { - match self { - Tuple5::_T5{_0, _1, _2, _3, _4, } => _1, - } - } - pub fn _2(&self) -> &T2 { - match self { - Tuple5::_T5{_0, _1, _2, _3, _4, } => _2, - } - } - pub fn _3(&self) -> &T3 { - match self { - Tuple5::_T5{_0, _1, _2, _3, _4, } => _3, - } - } - pub fn _4(&self) -> &T4 { - match self { - Tuple5::_T5{_0, _1, _2, _3, _4, } => _4, - } - } - } - - impl Debug - for Tuple5 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple5 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple5::_T5{_0, _1, _2, _3, _4, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_1, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_2, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_3, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_4, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple5 { - pub fn coerce(f_0: Rc r#__T0 + 'static>, f_1: Rc r#__T1 + 'static>, f_2: Rc r#__T2 + 'static>, f_3: Rc r#__T3 + 'static>, f_4: Rc r#__T4 + 'static>) -> Rc) -> Tuple5> { - Rc::new(move |this: Self| -> Tuple5{ - match this { - Tuple5::_T5{_0, _1, _2, _3, _4, } => { - Tuple5::_T5 { - _0: f_0.clone()(_0), - _1: f_1.clone()(_1), - _2: f_2.clone()(_2), - _3: f_3.clone()(_3), - _4: f_4.clone()(_4) - } - }, - } - }) - } - } - - impl Eq - for Tuple5 {} - - impl Hash - for Tuple5 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple5::_T5{_0, _1, _2, _3, _4, } => { - Hash::hash(_0, _state); - Hash::hash(_1, _state); - Hash::hash(_2, _state); - Hash::hash(_3, _state); - Hash::hash(_4, _state) - }, - } - } - } - - impl Default - for Tuple5 { - fn default() -> Tuple5 { - Tuple5::_T5 { - _0: Default::default(), - _1: Default::default(), - _2: Default::default(), - _3: Default::default(), - _4: Default::default() - } - } - } - - impl AsRef> - for Tuple5 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple6 { - _T6 { - _0: T0, - _1: T1, - _2: T2, - _3: T3, - _4: T4, - _5: T5 - } - } - - impl Tuple6 { - pub fn _0(&self) -> &T0 { - match self { - Tuple6::_T6{_0, _1, _2, _3, _4, _5, } => _0, - } - } - pub fn _1(&self) -> &T1 { - match self { - Tuple6::_T6{_0, _1, _2, _3, _4, _5, } => _1, - } - } - pub fn _2(&self) -> &T2 { - match self { - Tuple6::_T6{_0, _1, _2, _3, _4, _5, } => _2, - } - } - pub fn _3(&self) -> &T3 { - match self { - Tuple6::_T6{_0, _1, _2, _3, _4, _5, } => _3, - } - } - pub fn _4(&self) -> &T4 { - match self { - Tuple6::_T6{_0, _1, _2, _3, _4, _5, } => _4, - } - } - pub fn _5(&self) -> &T5 { - match self { - Tuple6::_T6{_0, _1, _2, _3, _4, _5, } => _5, - } - } - } - - impl Debug - for Tuple6 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple6 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple6::_T6{_0, _1, _2, _3, _4, _5, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_1, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_2, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_3, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_4, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_5, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple6 { - pub fn coerce(f_0: Rc r#__T0 + 'static>, f_1: Rc r#__T1 + 'static>, f_2: Rc r#__T2 + 'static>, f_3: Rc r#__T3 + 'static>, f_4: Rc r#__T4 + 'static>, f_5: Rc r#__T5 + 'static>) -> Rc) -> Tuple6> { - Rc::new(move |this: Self| -> Tuple6{ - match this { - Tuple6::_T6{_0, _1, _2, _3, _4, _5, } => { - Tuple6::_T6 { - _0: f_0.clone()(_0), - _1: f_1.clone()(_1), - _2: f_2.clone()(_2), - _3: f_3.clone()(_3), - _4: f_4.clone()(_4), - _5: f_5.clone()(_5) - } - }, - } - }) - } - } - - impl Eq - for Tuple6 {} - - impl Hash - for Tuple6 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple6::_T6{_0, _1, _2, _3, _4, _5, } => { - Hash::hash(_0, _state); - Hash::hash(_1, _state); - Hash::hash(_2, _state); - Hash::hash(_3, _state); - Hash::hash(_4, _state); - Hash::hash(_5, _state) - }, - } - } - } - - impl Default - for Tuple6 { - fn default() -> Tuple6 { - Tuple6::_T6 { - _0: Default::default(), - _1: Default::default(), - _2: Default::default(), - _3: Default::default(), - _4: Default::default(), - _5: Default::default() - } - } - } - - impl AsRef> - for Tuple6 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple7 { - _T7 { - _0: T0, - _1: T1, - _2: T2, - _3: T3, - _4: T4, - _5: T5, - _6: T6 - } - } - - impl Tuple7 { - pub fn _0(&self) -> &T0 { - match self { - Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => _0, - } - } - pub fn _1(&self) -> &T1 { - match self { - Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => _1, - } - } - pub fn _2(&self) -> &T2 { - match self { - Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => _2, - } - } - pub fn _3(&self) -> &T3 { - match self { - Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => _3, - } - } - pub fn _4(&self) -> &T4 { - match self { - Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => _4, - } - } - pub fn _5(&self) -> &T5 { - match self { - Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => _5, - } - } - pub fn _6(&self) -> &T6 { - match self { - Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => _6, - } - } - } - - impl Debug - for Tuple7 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple7 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_1, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_2, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_3, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_4, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_5, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_6, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple7 { - pub fn coerce(f_0: Rc r#__T0 + 'static>, f_1: Rc r#__T1 + 'static>, f_2: Rc r#__T2 + 'static>, f_3: Rc r#__T3 + 'static>, f_4: Rc r#__T4 + 'static>, f_5: Rc r#__T5 + 'static>, f_6: Rc r#__T6 + 'static>) -> Rc) -> Tuple7> { - Rc::new(move |this: Self| -> Tuple7{ - match this { - Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => { - Tuple7::_T7 { - _0: f_0.clone()(_0), - _1: f_1.clone()(_1), - _2: f_2.clone()(_2), - _3: f_3.clone()(_3), - _4: f_4.clone()(_4), - _5: f_5.clone()(_5), - _6: f_6.clone()(_6) - } - }, - } - }) - } - } - - impl Eq - for Tuple7 {} - - impl Hash - for Tuple7 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => { - Hash::hash(_0, _state); - Hash::hash(_1, _state); - Hash::hash(_2, _state); - Hash::hash(_3, _state); - Hash::hash(_4, _state); - Hash::hash(_5, _state); - Hash::hash(_6, _state) - }, - } - } - } - - impl Default - for Tuple7 { - fn default() -> Tuple7 { - Tuple7::_T7 { - _0: Default::default(), - _1: Default::default(), - _2: Default::default(), - _3: Default::default(), - _4: Default::default(), - _5: Default::default(), - _6: Default::default() - } - } - } - - impl AsRef> - for Tuple7 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple8 { - _T8 { - _0: T0, - _1: T1, - _2: T2, - _3: T3, - _4: T4, - _5: T5, - _6: T6, - _7: T7 - } - } - - impl Tuple8 { - pub fn _0(&self) -> &T0 { - match self { - Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => _0, - } - } - pub fn _1(&self) -> &T1 { - match self { - Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => _1, - } - } - pub fn _2(&self) -> &T2 { - match self { - Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => _2, - } - } - pub fn _3(&self) -> &T3 { - match self { - Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => _3, - } - } - pub fn _4(&self) -> &T4 { - match self { - Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => _4, - } - } - pub fn _5(&self) -> &T5 { - match self { - Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => _5, - } - } - pub fn _6(&self) -> &T6 { - match self { - Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => _6, - } - } - pub fn _7(&self) -> &T7 { - match self { - Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => _7, - } - } - } - - impl Debug - for Tuple8 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple8 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_1, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_2, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_3, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_4, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_5, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_6, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_7, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple8 { - pub fn coerce(f_0: Rc r#__T0 + 'static>, f_1: Rc r#__T1 + 'static>, f_2: Rc r#__T2 + 'static>, f_3: Rc r#__T3 + 'static>, f_4: Rc r#__T4 + 'static>, f_5: Rc r#__T5 + 'static>, f_6: Rc r#__T6 + 'static>, f_7: Rc r#__T7 + 'static>) -> Rc) -> Tuple8> { - Rc::new(move |this: Self| -> Tuple8{ - match this { - Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => { - Tuple8::_T8 { - _0: f_0.clone()(_0), - _1: f_1.clone()(_1), - _2: f_2.clone()(_2), - _3: f_3.clone()(_3), - _4: f_4.clone()(_4), - _5: f_5.clone()(_5), - _6: f_6.clone()(_6), - _7: f_7.clone()(_7) - } - }, - } - }) - } - } - - impl Eq - for Tuple8 {} - - impl Hash - for Tuple8 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => { - Hash::hash(_0, _state); - Hash::hash(_1, _state); - Hash::hash(_2, _state); - Hash::hash(_3, _state); - Hash::hash(_4, _state); - Hash::hash(_5, _state); - Hash::hash(_6, _state); - Hash::hash(_7, _state) - }, - } - } - } - - impl Default - for Tuple8 { - fn default() -> Tuple8 { - Tuple8::_T8 { - _0: Default::default(), - _1: Default::default(), - _2: Default::default(), - _3: Default::default(), - _4: Default::default(), - _5: Default::default(), - _6: Default::default(), - _7: Default::default() - } - } - } - - impl AsRef> - for Tuple8 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple9 { - _T9 { - _0: T0, - _1: T1, - _2: T2, - _3: T3, - _4: T4, - _5: T5, - _6: T6, - _7: T7, - _8: T8 - } - } - - impl Tuple9 { - pub fn _0(&self) -> &T0 { - match self { - Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => _0, - } - } - pub fn _1(&self) -> &T1 { - match self { - Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => _1, - } - } - pub fn _2(&self) -> &T2 { - match self { - Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => _2, - } - } - pub fn _3(&self) -> &T3 { - match self { - Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => _3, - } - } - pub fn _4(&self) -> &T4 { - match self { - Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => _4, - } - } - pub fn _5(&self) -> &T5 { - match self { - Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => _5, - } - } - pub fn _6(&self) -> &T6 { - match self { - Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => _6, - } - } - pub fn _7(&self) -> &T7 { - match self { - Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => _7, - } - } - pub fn _8(&self) -> &T8 { - match self { - Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => _8, - } - } - } - - impl Debug - for Tuple9 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple9 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_1, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_2, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_3, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_4, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_5, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_6, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_7, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_8, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple9 { - pub fn coerce(f_0: Rc r#__T0 + 'static>, f_1: Rc r#__T1 + 'static>, f_2: Rc r#__T2 + 'static>, f_3: Rc r#__T3 + 'static>, f_4: Rc r#__T4 + 'static>, f_5: Rc r#__T5 + 'static>, f_6: Rc r#__T6 + 'static>, f_7: Rc r#__T7 + 'static>, f_8: Rc r#__T8 + 'static>) -> Rc) -> Tuple9> { - Rc::new(move |this: Self| -> Tuple9{ - match this { - Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => { - Tuple9::_T9 { - _0: f_0.clone()(_0), - _1: f_1.clone()(_1), - _2: f_2.clone()(_2), - _3: f_3.clone()(_3), - _4: f_4.clone()(_4), - _5: f_5.clone()(_5), - _6: f_6.clone()(_6), - _7: f_7.clone()(_7), - _8: f_8.clone()(_8) - } - }, - } - }) - } - } - - impl Eq - for Tuple9 {} - - impl Hash - for Tuple9 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => { - Hash::hash(_0, _state); - Hash::hash(_1, _state); - Hash::hash(_2, _state); - Hash::hash(_3, _state); - Hash::hash(_4, _state); - Hash::hash(_5, _state); - Hash::hash(_6, _state); - Hash::hash(_7, _state); - Hash::hash(_8, _state) - }, - } - } - } - - impl Default - for Tuple9 { - fn default() -> Tuple9 { - Tuple9::_T9 { - _0: Default::default(), - _1: Default::default(), - _2: Default::default(), - _3: Default::default(), - _4: Default::default(), - _5: Default::default(), - _6: Default::default(), - _7: Default::default(), - _8: Default::default() - } - } - } - - impl AsRef> - for Tuple9 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple10 { - _T10 { - _0: T0, - _1: T1, - _2: T2, - _3: T3, - _4: T4, - _5: T5, - _6: T6, - _7: T7, - _8: T8, - _9: T9 - } - } - - impl Tuple10 { - pub fn _0(&self) -> &T0 { - match self { - Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _0, - } - } - pub fn _1(&self) -> &T1 { - match self { - Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _1, - } - } - pub fn _2(&self) -> &T2 { - match self { - Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _2, - } - } - pub fn _3(&self) -> &T3 { - match self { - Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _3, - } - } - pub fn _4(&self) -> &T4 { - match self { - Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _4, - } - } - pub fn _5(&self) -> &T5 { - match self { - Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _5, - } - } - pub fn _6(&self) -> &T6 { - match self { - Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _6, - } - } - pub fn _7(&self) -> &T7 { - match self { - Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _7, - } - } - pub fn _8(&self) -> &T8 { - match self { - Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _8, - } - } - pub fn _9(&self) -> &T9 { - match self { - Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _9, - } - } - } - - impl Debug - for Tuple10 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple10 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_1, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_2, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_3, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_4, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_5, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_6, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_7, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_8, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_9, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple10 { - pub fn coerce(f_0: Rc r#__T0 + 'static>, f_1: Rc r#__T1 + 'static>, f_2: Rc r#__T2 + 'static>, f_3: Rc r#__T3 + 'static>, f_4: Rc r#__T4 + 'static>, f_5: Rc r#__T5 + 'static>, f_6: Rc r#__T6 + 'static>, f_7: Rc r#__T7 + 'static>, f_8: Rc r#__T8 + 'static>, f_9: Rc r#__T9 + 'static>) -> Rc) -> Tuple10> { - Rc::new(move |this: Self| -> Tuple10{ - match this { - Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => { - Tuple10::_T10 { - _0: f_0.clone()(_0), - _1: f_1.clone()(_1), - _2: f_2.clone()(_2), - _3: f_3.clone()(_3), - _4: f_4.clone()(_4), - _5: f_5.clone()(_5), - _6: f_6.clone()(_6), - _7: f_7.clone()(_7), - _8: f_8.clone()(_8), - _9: f_9.clone()(_9) - } - }, - } - }) - } - } - - impl Eq - for Tuple10 {} - - impl Hash - for Tuple10 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => { - Hash::hash(_0, _state); - Hash::hash(_1, _state); - Hash::hash(_2, _state); - Hash::hash(_3, _state); - Hash::hash(_4, _state); - Hash::hash(_5, _state); - Hash::hash(_6, _state); - Hash::hash(_7, _state); - Hash::hash(_8, _state); - Hash::hash(_9, _state) - }, - } - } - } - - impl Default - for Tuple10 { - fn default() -> Tuple10 { - Tuple10::_T10 { - _0: Default::default(), - _1: Default::default(), - _2: Default::default(), - _3: Default::default(), - _4: Default::default(), - _5: Default::default(), - _6: Default::default(), - _7: Default::default(), - _8: Default::default(), - _9: Default::default() - } - } - } - - impl AsRef> - for Tuple10 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple11 { - _T11 { - _0: T0, - _1: T1, - _2: T2, - _3: T3, - _4: T4, - _5: T5, - _6: T6, - _7: T7, - _8: T8, - _9: T9, - _10: T10 - } - } - - impl Tuple11 { - pub fn _0(&self) -> &T0 { - match self { - Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _0, - } - } - pub fn _1(&self) -> &T1 { - match self { - Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _1, - } - } - pub fn _2(&self) -> &T2 { - match self { - Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _2, - } - } - pub fn _3(&self) -> &T3 { - match self { - Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _3, - } - } - pub fn _4(&self) -> &T4 { - match self { - Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _4, - } - } - pub fn _5(&self) -> &T5 { - match self { - Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _5, - } - } - pub fn _6(&self) -> &T6 { - match self { - Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _6, - } - } - pub fn _7(&self) -> &T7 { - match self { - Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _7, - } - } - pub fn _8(&self) -> &T8 { - match self { - Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _8, - } - } - pub fn _9(&self) -> &T9 { - match self { - Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _9, - } - } - pub fn _10(&self) -> &T10 { - match self { - Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _10, - } - } - } - - impl Debug - for Tuple11 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple11 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_1, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_2, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_3, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_4, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_5, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_6, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_7, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_8, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_9, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_10, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple11 { - pub fn coerce(f_0: Rc r#__T0 + 'static>, f_1: Rc r#__T1 + 'static>, f_2: Rc r#__T2 + 'static>, f_3: Rc r#__T3 + 'static>, f_4: Rc r#__T4 + 'static>, f_5: Rc r#__T5 + 'static>, f_6: Rc r#__T6 + 'static>, f_7: Rc r#__T7 + 'static>, f_8: Rc r#__T8 + 'static>, f_9: Rc r#__T9 + 'static>, f_10: Rc r#__T10 + 'static>) -> Rc) -> Tuple11> { - Rc::new(move |this: Self| -> Tuple11{ - match this { - Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => { - Tuple11::_T11 { - _0: f_0.clone()(_0), - _1: f_1.clone()(_1), - _2: f_2.clone()(_2), - _3: f_3.clone()(_3), - _4: f_4.clone()(_4), - _5: f_5.clone()(_5), - _6: f_6.clone()(_6), - _7: f_7.clone()(_7), - _8: f_8.clone()(_8), - _9: f_9.clone()(_9), - _10: f_10.clone()(_10) - } - }, - } - }) - } - } - - impl Eq - for Tuple11 {} - - impl Hash - for Tuple11 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => { - Hash::hash(_0, _state); - Hash::hash(_1, _state); - Hash::hash(_2, _state); - Hash::hash(_3, _state); - Hash::hash(_4, _state); - Hash::hash(_5, _state); - Hash::hash(_6, _state); - Hash::hash(_7, _state); - Hash::hash(_8, _state); - Hash::hash(_9, _state); - Hash::hash(_10, _state) - }, - } - } - } - - impl Default - for Tuple11 { - fn default() -> Tuple11 { - Tuple11::_T11 { - _0: Default::default(), - _1: Default::default(), - _2: Default::default(), - _3: Default::default(), - _4: Default::default(), - _5: Default::default(), - _6: Default::default(), - _7: Default::default(), - _8: Default::default(), - _9: Default::default(), - _10: Default::default() - } - } - } - - impl AsRef> - for Tuple11 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple12 { - _T12 { - _0: T0, - _1: T1, - _2: T2, - _3: T3, - _4: T4, - _5: T5, - _6: T6, - _7: T7, - _8: T8, - _9: T9, - _10: T10, - _11: T11 - } - } - - impl Tuple12 { - pub fn _0(&self) -> &T0 { - match self { - Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _0, - } - } - pub fn _1(&self) -> &T1 { - match self { - Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _1, - } - } - pub fn _2(&self) -> &T2 { - match self { - Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _2, - } - } - pub fn _3(&self) -> &T3 { - match self { - Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _3, - } - } - pub fn _4(&self) -> &T4 { - match self { - Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _4, - } - } - pub fn _5(&self) -> &T5 { - match self { - Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _5, - } - } - pub fn _6(&self) -> &T6 { - match self { - Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _6, - } - } - pub fn _7(&self) -> &T7 { - match self { - Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _7, - } - } - pub fn _8(&self) -> &T8 { - match self { - Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _8, - } - } - pub fn _9(&self) -> &T9 { - match self { - Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _9, - } - } - pub fn _10(&self) -> &T10 { - match self { - Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _10, - } - } - pub fn _11(&self) -> &T11 { - match self { - Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _11, - } - } - } - - impl Debug - for Tuple12 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple12 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_1, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_2, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_3, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_4, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_5, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_6, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_7, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_8, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_9, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_10, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_11, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple12 { - pub fn coerce(f_0: Rc r#__T0 + 'static>, f_1: Rc r#__T1 + 'static>, f_2: Rc r#__T2 + 'static>, f_3: Rc r#__T3 + 'static>, f_4: Rc r#__T4 + 'static>, f_5: Rc r#__T5 + 'static>, f_6: Rc r#__T6 + 'static>, f_7: Rc r#__T7 + 'static>, f_8: Rc r#__T8 + 'static>, f_9: Rc r#__T9 + 'static>, f_10: Rc r#__T10 + 'static>, f_11: Rc r#__T11 + 'static>) -> Rc) -> Tuple12> { - Rc::new(move |this: Self| -> Tuple12{ - match this { - Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => { - Tuple12::_T12 { - _0: f_0.clone()(_0), - _1: f_1.clone()(_1), - _2: f_2.clone()(_2), - _3: f_3.clone()(_3), - _4: f_4.clone()(_4), - _5: f_5.clone()(_5), - _6: f_6.clone()(_6), - _7: f_7.clone()(_7), - _8: f_8.clone()(_8), - _9: f_9.clone()(_9), - _10: f_10.clone()(_10), - _11: f_11.clone()(_11) - } - }, - } - }) - } - } - - impl Eq - for Tuple12 {} - - impl Hash - for Tuple12 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => { - Hash::hash(_0, _state); - Hash::hash(_1, _state); - Hash::hash(_2, _state); - Hash::hash(_3, _state); - Hash::hash(_4, _state); - Hash::hash(_5, _state); - Hash::hash(_6, _state); - Hash::hash(_7, _state); - Hash::hash(_8, _state); - Hash::hash(_9, _state); - Hash::hash(_10, _state); - Hash::hash(_11, _state) - }, - } - } - } - - impl Default - for Tuple12 { - fn default() -> Tuple12 { - Tuple12::_T12 { - _0: Default::default(), - _1: Default::default(), - _2: Default::default(), - _3: Default::default(), - _4: Default::default(), - _5: Default::default(), - _6: Default::default(), - _7: Default::default(), - _8: Default::default(), - _9: Default::default(), - _10: Default::default(), - _11: Default::default() - } - } - } - - impl AsRef> - for Tuple12 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple13 { - _T13 { - _0: T0, - _1: T1, - _2: T2, - _3: T3, - _4: T4, - _5: T5, - _6: T6, - _7: T7, - _8: T8, - _9: T9, - _10: T10, - _11: T11, - _12: T12 - } - } - - impl Tuple13 { - pub fn _0(&self) -> &T0 { - match self { - Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _0, - } - } - pub fn _1(&self) -> &T1 { - match self { - Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _1, - } - } - pub fn _2(&self) -> &T2 { - match self { - Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _2, - } - } - pub fn _3(&self) -> &T3 { - match self { - Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _3, - } - } - pub fn _4(&self) -> &T4 { - match self { - Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _4, - } - } - pub fn _5(&self) -> &T5 { - match self { - Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _5, - } - } - pub fn _6(&self) -> &T6 { - match self { - Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _6, - } - } - pub fn _7(&self) -> &T7 { - match self { - Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _7, - } - } - pub fn _8(&self) -> &T8 { - match self { - Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _8, - } - } - pub fn _9(&self) -> &T9 { - match self { - Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _9, - } - } - pub fn _10(&self) -> &T10 { - match self { - Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _10, - } - } - pub fn _11(&self) -> &T11 { - match self { - Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _11, - } - } - pub fn _12(&self) -> &T12 { - match self { - Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _12, - } - } - } - - impl Debug - for Tuple13 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple13 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_1, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_2, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_3, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_4, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_5, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_6, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_7, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_8, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_9, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_10, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_11, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_12, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple13 { - pub fn coerce(f_0: Rc r#__T0 + 'static>, f_1: Rc r#__T1 + 'static>, f_2: Rc r#__T2 + 'static>, f_3: Rc r#__T3 + 'static>, f_4: Rc r#__T4 + 'static>, f_5: Rc r#__T5 + 'static>, f_6: Rc r#__T6 + 'static>, f_7: Rc r#__T7 + 'static>, f_8: Rc r#__T8 + 'static>, f_9: Rc r#__T9 + 'static>, f_10: Rc r#__T10 + 'static>, f_11: Rc r#__T11 + 'static>, f_12: Rc r#__T12 + 'static>) -> Rc) -> Tuple13> { - Rc::new(move |this: Self| -> Tuple13{ - match this { - Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => { - Tuple13::_T13 { - _0: f_0.clone()(_0), - _1: f_1.clone()(_1), - _2: f_2.clone()(_2), - _3: f_3.clone()(_3), - _4: f_4.clone()(_4), - _5: f_5.clone()(_5), - _6: f_6.clone()(_6), - _7: f_7.clone()(_7), - _8: f_8.clone()(_8), - _9: f_9.clone()(_9), - _10: f_10.clone()(_10), - _11: f_11.clone()(_11), - _12: f_12.clone()(_12) - } - }, - } - }) - } - } - - impl Eq - for Tuple13 {} - - impl Hash - for Tuple13 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => { - Hash::hash(_0, _state); - Hash::hash(_1, _state); - Hash::hash(_2, _state); - Hash::hash(_3, _state); - Hash::hash(_4, _state); - Hash::hash(_5, _state); - Hash::hash(_6, _state); - Hash::hash(_7, _state); - Hash::hash(_8, _state); - Hash::hash(_9, _state); - Hash::hash(_10, _state); - Hash::hash(_11, _state); - Hash::hash(_12, _state) - }, - } - } - } - - impl Default - for Tuple13 { - fn default() -> Tuple13 { - Tuple13::_T13 { - _0: Default::default(), - _1: Default::default(), - _2: Default::default(), - _3: Default::default(), - _4: Default::default(), - _5: Default::default(), - _6: Default::default(), - _7: Default::default(), - _8: Default::default(), - _9: Default::default(), - _10: Default::default(), - _11: Default::default(), - _12: Default::default() - } - } - } - - impl AsRef> - for Tuple13 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple14 { - _T14 { - _0: T0, - _1: T1, - _2: T2, - _3: T3, - _4: T4, - _5: T5, - _6: T6, - _7: T7, - _8: T8, - _9: T9, - _10: T10, - _11: T11, - _12: T12, - _13: T13 - } - } - - impl Tuple14 { - pub fn _0(&self) -> &T0 { - match self { - Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _0, - } - } - pub fn _1(&self) -> &T1 { - match self { - Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _1, - } - } - pub fn _2(&self) -> &T2 { - match self { - Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _2, - } - } - pub fn _3(&self) -> &T3 { - match self { - Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _3, - } - } - pub fn _4(&self) -> &T4 { - match self { - Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _4, - } - } - pub fn _5(&self) -> &T5 { - match self { - Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _5, - } - } - pub fn _6(&self) -> &T6 { - match self { - Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _6, - } - } - pub fn _7(&self) -> &T7 { - match self { - Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _7, - } - } - pub fn _8(&self) -> &T8 { - match self { - Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _8, - } - } - pub fn _9(&self) -> &T9 { - match self { - Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _9, - } - } - pub fn _10(&self) -> &T10 { - match self { - Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _10, - } - } - pub fn _11(&self) -> &T11 { - match self { - Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _11, - } - } - pub fn _12(&self) -> &T12 { - match self { - Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _12, - } - } - pub fn _13(&self) -> &T13 { - match self { - Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _13, - } - } - } - - impl Debug - for Tuple14 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple14 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_1, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_2, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_3, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_4, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_5, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_6, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_7, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_8, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_9, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_10, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_11, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_12, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_13, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple14 { - pub fn coerce(f_0: Rc r#__T0 + 'static>, f_1: Rc r#__T1 + 'static>, f_2: Rc r#__T2 + 'static>, f_3: Rc r#__T3 + 'static>, f_4: Rc r#__T4 + 'static>, f_5: Rc r#__T5 + 'static>, f_6: Rc r#__T6 + 'static>, f_7: Rc r#__T7 + 'static>, f_8: Rc r#__T8 + 'static>, f_9: Rc r#__T9 + 'static>, f_10: Rc r#__T10 + 'static>, f_11: Rc r#__T11 + 'static>, f_12: Rc r#__T12 + 'static>, f_13: Rc r#__T13 + 'static>) -> Rc) -> Tuple14> { - Rc::new(move |this: Self| -> Tuple14{ - match this { - Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => { - Tuple14::_T14 { - _0: f_0.clone()(_0), - _1: f_1.clone()(_1), - _2: f_2.clone()(_2), - _3: f_3.clone()(_3), - _4: f_4.clone()(_4), - _5: f_5.clone()(_5), - _6: f_6.clone()(_6), - _7: f_7.clone()(_7), - _8: f_8.clone()(_8), - _9: f_9.clone()(_9), - _10: f_10.clone()(_10), - _11: f_11.clone()(_11), - _12: f_12.clone()(_12), - _13: f_13.clone()(_13) - } - }, - } - }) - } - } - - impl Eq - for Tuple14 {} - - impl Hash - for Tuple14 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => { - Hash::hash(_0, _state); - Hash::hash(_1, _state); - Hash::hash(_2, _state); - Hash::hash(_3, _state); - Hash::hash(_4, _state); - Hash::hash(_5, _state); - Hash::hash(_6, _state); - Hash::hash(_7, _state); - Hash::hash(_8, _state); - Hash::hash(_9, _state); - Hash::hash(_10, _state); - Hash::hash(_11, _state); - Hash::hash(_12, _state); - Hash::hash(_13, _state) - }, - } - } - } - - impl Default - for Tuple14 { - fn default() -> Tuple14 { - Tuple14::_T14 { - _0: Default::default(), - _1: Default::default(), - _2: Default::default(), - _3: Default::default(), - _4: Default::default(), - _5: Default::default(), - _6: Default::default(), - _7: Default::default(), - _8: Default::default(), - _9: Default::default(), - _10: Default::default(), - _11: Default::default(), - _12: Default::default(), - _13: Default::default() - } - } - } - - impl AsRef> - for Tuple14 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple15 { - _T15 { - _0: T0, - _1: T1, - _2: T2, - _3: T3, - _4: T4, - _5: T5, - _6: T6, - _7: T7, - _8: T8, - _9: T9, - _10: T10, - _11: T11, - _12: T12, - _13: T13, - _14: T14 - } - } - - impl Tuple15 { - pub fn _0(&self) -> &T0 { - match self { - Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _0, - } - } - pub fn _1(&self) -> &T1 { - match self { - Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _1, - } - } - pub fn _2(&self) -> &T2 { - match self { - Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _2, - } - } - pub fn _3(&self) -> &T3 { - match self { - Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _3, - } - } - pub fn _4(&self) -> &T4 { - match self { - Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _4, - } - } - pub fn _5(&self) -> &T5 { - match self { - Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _5, - } - } - pub fn _6(&self) -> &T6 { - match self { - Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _6, - } - } - pub fn _7(&self) -> &T7 { - match self { - Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _7, - } - } - pub fn _8(&self) -> &T8 { - match self { - Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _8, - } - } - pub fn _9(&self) -> &T9 { - match self { - Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _9, - } - } - pub fn _10(&self) -> &T10 { - match self { - Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _10, - } - } - pub fn _11(&self) -> &T11 { - match self { - Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _11, - } - } - pub fn _12(&self) -> &T12 { - match self { - Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _12, - } - } - pub fn _13(&self) -> &T13 { - match self { - Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _13, - } - } - pub fn _14(&self) -> &T14 { - match self { - Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _14, - } - } - } - - impl Debug - for Tuple15 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple15 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_1, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_2, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_3, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_4, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_5, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_6, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_7, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_8, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_9, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_10, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_11, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_12, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_13, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_14, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple15 { - pub fn coerce(f_0: Rc r#__T0 + 'static>, f_1: Rc r#__T1 + 'static>, f_2: Rc r#__T2 + 'static>, f_3: Rc r#__T3 + 'static>, f_4: Rc r#__T4 + 'static>, f_5: Rc r#__T5 + 'static>, f_6: Rc r#__T6 + 'static>, f_7: Rc r#__T7 + 'static>, f_8: Rc r#__T8 + 'static>, f_9: Rc r#__T9 + 'static>, f_10: Rc r#__T10 + 'static>, f_11: Rc r#__T11 + 'static>, f_12: Rc r#__T12 + 'static>, f_13: Rc r#__T13 + 'static>, f_14: Rc r#__T14 + 'static>) -> Rc) -> Tuple15> { - Rc::new(move |this: Self| -> Tuple15{ - match this { - Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => { - Tuple15::_T15 { - _0: f_0.clone()(_0), - _1: f_1.clone()(_1), - _2: f_2.clone()(_2), - _3: f_3.clone()(_3), - _4: f_4.clone()(_4), - _5: f_5.clone()(_5), - _6: f_6.clone()(_6), - _7: f_7.clone()(_7), - _8: f_8.clone()(_8), - _9: f_9.clone()(_9), - _10: f_10.clone()(_10), - _11: f_11.clone()(_11), - _12: f_12.clone()(_12), - _13: f_13.clone()(_13), - _14: f_14.clone()(_14) - } - }, - } - }) - } - } - - impl Eq - for Tuple15 {} - - impl Hash - for Tuple15 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => { - Hash::hash(_0, _state); - Hash::hash(_1, _state); - Hash::hash(_2, _state); - Hash::hash(_3, _state); - Hash::hash(_4, _state); - Hash::hash(_5, _state); - Hash::hash(_6, _state); - Hash::hash(_7, _state); - Hash::hash(_8, _state); - Hash::hash(_9, _state); - Hash::hash(_10, _state); - Hash::hash(_11, _state); - Hash::hash(_12, _state); - Hash::hash(_13, _state); - Hash::hash(_14, _state) - }, - } - } - } - - impl Default - for Tuple15 { - fn default() -> Tuple15 { - Tuple15::_T15 { - _0: Default::default(), - _1: Default::default(), - _2: Default::default(), - _3: Default::default(), - _4: Default::default(), - _5: Default::default(), - _6: Default::default(), - _7: Default::default(), - _8: Default::default(), - _9: Default::default(), - _10: Default::default(), - _11: Default::default(), - _12: Default::default(), - _13: Default::default(), - _14: Default::default() - } - } - } - - impl AsRef> - for Tuple15 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple16 { - _T16 { - _0: T0, - _1: T1, - _2: T2, - _3: T3, - _4: T4, - _5: T5, - _6: T6, - _7: T7, - _8: T8, - _9: T9, - _10: T10, - _11: T11, - _12: T12, - _13: T13, - _14: T14, - _15: T15 - } - } - - impl Tuple16 { - pub fn _0(&self) -> &T0 { - match self { - Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _0, - } - } - pub fn _1(&self) -> &T1 { - match self { - Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _1, - } - } - pub fn _2(&self) -> &T2 { - match self { - Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _2, - } - } - pub fn _3(&self) -> &T3 { - match self { - Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _3, - } - } - pub fn _4(&self) -> &T4 { - match self { - Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _4, - } - } - pub fn _5(&self) -> &T5 { - match self { - Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _5, - } - } - pub fn _6(&self) -> &T6 { - match self { - Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _6, - } - } - pub fn _7(&self) -> &T7 { - match self { - Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _7, - } - } - pub fn _8(&self) -> &T8 { - match self { - Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _8, - } - } - pub fn _9(&self) -> &T9 { - match self { - Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _9, - } - } - pub fn _10(&self) -> &T10 { - match self { - Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _10, - } - } - pub fn _11(&self) -> &T11 { - match self { - Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _11, - } - } - pub fn _12(&self) -> &T12 { - match self { - Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _12, - } - } - pub fn _13(&self) -> &T13 { - match self { - Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _13, - } - } - pub fn _14(&self) -> &T14 { - match self { - Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _14, - } - } - pub fn _15(&self) -> &T15 { - match self { - Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _15, - } - } - } - - impl Debug - for Tuple16 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple16 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_1, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_2, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_3, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_4, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_5, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_6, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_7, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_8, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_9, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_10, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_11, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_12, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_13, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_14, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_15, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple16 { - pub fn coerce(f_0: Rc r#__T0 + 'static>, f_1: Rc r#__T1 + 'static>, f_2: Rc r#__T2 + 'static>, f_3: Rc r#__T3 + 'static>, f_4: Rc r#__T4 + 'static>, f_5: Rc r#__T5 + 'static>, f_6: Rc r#__T6 + 'static>, f_7: Rc r#__T7 + 'static>, f_8: Rc r#__T8 + 'static>, f_9: Rc r#__T9 + 'static>, f_10: Rc r#__T10 + 'static>, f_11: Rc r#__T11 + 'static>, f_12: Rc r#__T12 + 'static>, f_13: Rc r#__T13 + 'static>, f_14: Rc r#__T14 + 'static>, f_15: Rc r#__T15 + 'static>) -> Rc) -> Tuple16> { - Rc::new(move |this: Self| -> Tuple16{ - match this { - Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => { - Tuple16::_T16 { - _0: f_0.clone()(_0), - _1: f_1.clone()(_1), - _2: f_2.clone()(_2), - _3: f_3.clone()(_3), - _4: f_4.clone()(_4), - _5: f_5.clone()(_5), - _6: f_6.clone()(_6), - _7: f_7.clone()(_7), - _8: f_8.clone()(_8), - _9: f_9.clone()(_9), - _10: f_10.clone()(_10), - _11: f_11.clone()(_11), - _12: f_12.clone()(_12), - _13: f_13.clone()(_13), - _14: f_14.clone()(_14), - _15: f_15.clone()(_15) - } - }, - } - }) - } - } - - impl Eq - for Tuple16 {} - - impl Hash - for Tuple16 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => { - Hash::hash(_0, _state); - Hash::hash(_1, _state); - Hash::hash(_2, _state); - Hash::hash(_3, _state); - Hash::hash(_4, _state); - Hash::hash(_5, _state); - Hash::hash(_6, _state); - Hash::hash(_7, _state); - Hash::hash(_8, _state); - Hash::hash(_9, _state); - Hash::hash(_10, _state); - Hash::hash(_11, _state); - Hash::hash(_12, _state); - Hash::hash(_13, _state); - Hash::hash(_14, _state); - Hash::hash(_15, _state) - }, - } - } - } - - impl Default - for Tuple16 { - fn default() -> Tuple16 { - Tuple16::_T16 { - _0: Default::default(), - _1: Default::default(), - _2: Default::default(), - _3: Default::default(), - _4: Default::default(), - _5: Default::default(), - _6: Default::default(), - _7: Default::default(), - _8: Default::default(), - _9: Default::default(), - _10: Default::default(), - _11: Default::default(), - _12: Default::default(), - _13: Default::default(), - _14: Default::default(), - _15: Default::default() - } - } - } - - impl AsRef> - for Tuple16 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple17 { - _T17 { - _0: T0, - _1: T1, - _2: T2, - _3: T3, - _4: T4, - _5: T5, - _6: T6, - _7: T7, - _8: T8, - _9: T9, - _10: T10, - _11: T11, - _12: T12, - _13: T13, - _14: T14, - _15: T15, - _16: T16 - } - } - - impl Tuple17 { - pub fn _0(&self) -> &T0 { - match self { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _0, - } - } - pub fn _1(&self) -> &T1 { - match self { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _1, - } - } - pub fn _2(&self) -> &T2 { - match self { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _2, - } - } - pub fn _3(&self) -> &T3 { - match self { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _3, - } - } - pub fn _4(&self) -> &T4 { - match self { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _4, - } - } - pub fn _5(&self) -> &T5 { - match self { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _5, - } - } - pub fn _6(&self) -> &T6 { - match self { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _6, - } - } - pub fn _7(&self) -> &T7 { - match self { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _7, - } - } - pub fn _8(&self) -> &T8 { - match self { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _8, - } - } - pub fn _9(&self) -> &T9 { - match self { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _9, - } - } - pub fn _10(&self) -> &T10 { - match self { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _10, - } - } - pub fn _11(&self) -> &T11 { - match self { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _11, - } - } - pub fn _12(&self) -> &T12 { - match self { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _12, - } - } - pub fn _13(&self) -> &T13 { - match self { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _13, - } - } - pub fn _14(&self) -> &T14 { - match self { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _14, - } - } - pub fn _15(&self) -> &T15 { - match self { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _15, - } - } - pub fn _16(&self) -> &T16 { - match self { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _16, - } - } - } - - impl Debug - for Tuple17 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple17 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_1, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_2, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_3, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_4, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_5, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_6, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_7, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_8, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_9, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_10, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_11, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_12, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_13, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_14, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_15, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_16, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple17 { - pub fn coerce(f_0: Rc r#__T0 + 'static>, f_1: Rc r#__T1 + 'static>, f_2: Rc r#__T2 + 'static>, f_3: Rc r#__T3 + 'static>, f_4: Rc r#__T4 + 'static>, f_5: Rc r#__T5 + 'static>, f_6: Rc r#__T6 + 'static>, f_7: Rc r#__T7 + 'static>, f_8: Rc r#__T8 + 'static>, f_9: Rc r#__T9 + 'static>, f_10: Rc r#__T10 + 'static>, f_11: Rc r#__T11 + 'static>, f_12: Rc r#__T12 + 'static>, f_13: Rc r#__T13 + 'static>, f_14: Rc r#__T14 + 'static>, f_15: Rc r#__T15 + 'static>, f_16: Rc r#__T16 + 'static>) -> Rc) -> Tuple17> { - Rc::new(move |this: Self| -> Tuple17{ - match this { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => { - Tuple17::_T17 { - _0: f_0.clone()(_0), - _1: f_1.clone()(_1), - _2: f_2.clone()(_2), - _3: f_3.clone()(_3), - _4: f_4.clone()(_4), - _5: f_5.clone()(_5), - _6: f_6.clone()(_6), - _7: f_7.clone()(_7), - _8: f_8.clone()(_8), - _9: f_9.clone()(_9), - _10: f_10.clone()(_10), - _11: f_11.clone()(_11), - _12: f_12.clone()(_12), - _13: f_13.clone()(_13), - _14: f_14.clone()(_14), - _15: f_15.clone()(_15), - _16: f_16.clone()(_16) - } - }, - } - }) - } - } - - impl Eq - for Tuple17 {} - - impl Hash - for Tuple17 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => { - Hash::hash(_0, _state); - Hash::hash(_1, _state); - Hash::hash(_2, _state); - Hash::hash(_3, _state); - Hash::hash(_4, _state); - Hash::hash(_5, _state); - Hash::hash(_6, _state); - Hash::hash(_7, _state); - Hash::hash(_8, _state); - Hash::hash(_9, _state); - Hash::hash(_10, _state); - Hash::hash(_11, _state); - Hash::hash(_12, _state); - Hash::hash(_13, _state); - Hash::hash(_14, _state); - Hash::hash(_15, _state); - Hash::hash(_16, _state) - }, - } - } - } - - impl Default - for Tuple17 { - fn default() -> Tuple17 { - Tuple17::_T17 { - _0: Default::default(), - _1: Default::default(), - _2: Default::default(), - _3: Default::default(), - _4: Default::default(), - _5: Default::default(), - _6: Default::default(), - _7: Default::default(), - _8: Default::default(), - _9: Default::default(), - _10: Default::default(), - _11: Default::default(), - _12: Default::default(), - _13: Default::default(), - _14: Default::default(), - _15: Default::default(), - _16: Default::default() - } - } - } - - impl AsRef> - for Tuple17 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple18 { - _T18 { - _0: T0, - _1: T1, - _2: T2, - _3: T3, - _4: T4, - _5: T5, - _6: T6, - _7: T7, - _8: T8, - _9: T9, - _10: T10, - _11: T11, - _12: T12, - _13: T13, - _14: T14, - _15: T15, - _16: T16, - _17: T17 - } - } - - impl Tuple18 { - pub fn _0(&self) -> &T0 { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _0, - } - } - pub fn _1(&self) -> &T1 { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _1, - } - } - pub fn _2(&self) -> &T2 { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _2, - } - } - pub fn _3(&self) -> &T3 { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _3, - } - } - pub fn _4(&self) -> &T4 { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _4, - } - } - pub fn _5(&self) -> &T5 { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _5, - } - } - pub fn _6(&self) -> &T6 { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _6, - } - } - pub fn _7(&self) -> &T7 { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _7, - } - } - pub fn _8(&self) -> &T8 { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _8, - } - } - pub fn _9(&self) -> &T9 { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _9, - } - } - pub fn _10(&self) -> &T10 { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _10, - } - } - pub fn _11(&self) -> &T11 { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _11, - } - } - pub fn _12(&self) -> &T12 { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _12, - } - } - pub fn _13(&self) -> &T13 { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _13, - } - } - pub fn _14(&self) -> &T14 { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _14, - } - } - pub fn _15(&self) -> &T15 { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _15, - } - } - pub fn _16(&self) -> &T16 { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _16, - } - } - pub fn _17(&self) -> &T17 { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _17, - } - } - } - - impl Debug - for Tuple18 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple18 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_1, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_2, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_3, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_4, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_5, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_6, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_7, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_8, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_9, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_10, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_11, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_12, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_13, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_14, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_15, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_16, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_17, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple18 { - pub fn coerce(f_0: Rc r#__T0 + 'static>, f_1: Rc r#__T1 + 'static>, f_2: Rc r#__T2 + 'static>, f_3: Rc r#__T3 + 'static>, f_4: Rc r#__T4 + 'static>, f_5: Rc r#__T5 + 'static>, f_6: Rc r#__T6 + 'static>, f_7: Rc r#__T7 + 'static>, f_8: Rc r#__T8 + 'static>, f_9: Rc r#__T9 + 'static>, f_10: Rc r#__T10 + 'static>, f_11: Rc r#__T11 + 'static>, f_12: Rc r#__T12 + 'static>, f_13: Rc r#__T13 + 'static>, f_14: Rc r#__T14 + 'static>, f_15: Rc r#__T15 + 'static>, f_16: Rc r#__T16 + 'static>, f_17: Rc r#__T17 + 'static>) -> Rc) -> Tuple18> { - Rc::new(move |this: Self| -> Tuple18{ - match this { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => { - Tuple18::_T18 { - _0: f_0.clone()(_0), - _1: f_1.clone()(_1), - _2: f_2.clone()(_2), - _3: f_3.clone()(_3), - _4: f_4.clone()(_4), - _5: f_5.clone()(_5), - _6: f_6.clone()(_6), - _7: f_7.clone()(_7), - _8: f_8.clone()(_8), - _9: f_9.clone()(_9), - _10: f_10.clone()(_10), - _11: f_11.clone()(_11), - _12: f_12.clone()(_12), - _13: f_13.clone()(_13), - _14: f_14.clone()(_14), - _15: f_15.clone()(_15), - _16: f_16.clone()(_16), - _17: f_17.clone()(_17) - } - }, - } - }) - } - } - - impl Eq - for Tuple18 {} - - impl Hash - for Tuple18 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => { - Hash::hash(_0, _state); - Hash::hash(_1, _state); - Hash::hash(_2, _state); - Hash::hash(_3, _state); - Hash::hash(_4, _state); - Hash::hash(_5, _state); - Hash::hash(_6, _state); - Hash::hash(_7, _state); - Hash::hash(_8, _state); - Hash::hash(_9, _state); - Hash::hash(_10, _state); - Hash::hash(_11, _state); - Hash::hash(_12, _state); - Hash::hash(_13, _state); - Hash::hash(_14, _state); - Hash::hash(_15, _state); - Hash::hash(_16, _state); - Hash::hash(_17, _state) - }, - } - } - } - - impl Default - for Tuple18 { - fn default() -> Tuple18 { - Tuple18::_T18 { - _0: Default::default(), - _1: Default::default(), - _2: Default::default(), - _3: Default::default(), - _4: Default::default(), - _5: Default::default(), - _6: Default::default(), - _7: Default::default(), - _8: Default::default(), - _9: Default::default(), - _10: Default::default(), - _11: Default::default(), - _12: Default::default(), - _13: Default::default(), - _14: Default::default(), - _15: Default::default(), - _16: Default::default(), - _17: Default::default() - } - } - } - - impl AsRef> - for Tuple18 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple19 { - _T19 { - _0: T0, - _1: T1, - _2: T2, - _3: T3, - _4: T4, - _5: T5, - _6: T6, - _7: T7, - _8: T8, - _9: T9, - _10: T10, - _11: T11, - _12: T12, - _13: T13, - _14: T14, - _15: T15, - _16: T16, - _17: T17, - _18: T18 - } - } - - impl Tuple19 { - pub fn _0(&self) -> &T0 { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _0, - } - } - pub fn _1(&self) -> &T1 { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _1, - } - } - pub fn _2(&self) -> &T2 { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _2, - } - } - pub fn _3(&self) -> &T3 { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _3, - } - } - pub fn _4(&self) -> &T4 { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _4, - } - } - pub fn _5(&self) -> &T5 { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _5, - } - } - pub fn _6(&self) -> &T6 { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _6, - } - } - pub fn _7(&self) -> &T7 { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _7, - } - } - pub fn _8(&self) -> &T8 { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _8, - } - } - pub fn _9(&self) -> &T9 { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _9, - } - } - pub fn _10(&self) -> &T10 { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _10, - } - } - pub fn _11(&self) -> &T11 { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _11, - } - } - pub fn _12(&self) -> &T12 { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _12, - } - } - pub fn _13(&self) -> &T13 { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _13, - } - } - pub fn _14(&self) -> &T14 { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _14, - } - } - pub fn _15(&self) -> &T15 { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _15, - } - } - pub fn _16(&self) -> &T16 { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _16, - } - } - pub fn _17(&self) -> &T17 { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _17, - } - } - pub fn _18(&self) -> &T18 { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _18, - } - } - } - - impl Debug - for Tuple19 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple19 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_1, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_2, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_3, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_4, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_5, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_6, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_7, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_8, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_9, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_10, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_11, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_12, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_13, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_14, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_15, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_16, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_17, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_18, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple19 { - pub fn coerce(f_0: Rc r#__T0 + 'static>, f_1: Rc r#__T1 + 'static>, f_2: Rc r#__T2 + 'static>, f_3: Rc r#__T3 + 'static>, f_4: Rc r#__T4 + 'static>, f_5: Rc r#__T5 + 'static>, f_6: Rc r#__T6 + 'static>, f_7: Rc r#__T7 + 'static>, f_8: Rc r#__T8 + 'static>, f_9: Rc r#__T9 + 'static>, f_10: Rc r#__T10 + 'static>, f_11: Rc r#__T11 + 'static>, f_12: Rc r#__T12 + 'static>, f_13: Rc r#__T13 + 'static>, f_14: Rc r#__T14 + 'static>, f_15: Rc r#__T15 + 'static>, f_16: Rc r#__T16 + 'static>, f_17: Rc r#__T17 + 'static>, f_18: Rc r#__T18 + 'static>) -> Rc) -> Tuple19> { - Rc::new(move |this: Self| -> Tuple19{ - match this { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => { - Tuple19::_T19 { - _0: f_0.clone()(_0), - _1: f_1.clone()(_1), - _2: f_2.clone()(_2), - _3: f_3.clone()(_3), - _4: f_4.clone()(_4), - _5: f_5.clone()(_5), - _6: f_6.clone()(_6), - _7: f_7.clone()(_7), - _8: f_8.clone()(_8), - _9: f_9.clone()(_9), - _10: f_10.clone()(_10), - _11: f_11.clone()(_11), - _12: f_12.clone()(_12), - _13: f_13.clone()(_13), - _14: f_14.clone()(_14), - _15: f_15.clone()(_15), - _16: f_16.clone()(_16), - _17: f_17.clone()(_17), - _18: f_18.clone()(_18) - } - }, - } - }) - } - } - - impl Eq - for Tuple19 {} - - impl Hash - for Tuple19 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => { - Hash::hash(_0, _state); - Hash::hash(_1, _state); - Hash::hash(_2, _state); - Hash::hash(_3, _state); - Hash::hash(_4, _state); - Hash::hash(_5, _state); - Hash::hash(_6, _state); - Hash::hash(_7, _state); - Hash::hash(_8, _state); - Hash::hash(_9, _state); - Hash::hash(_10, _state); - Hash::hash(_11, _state); - Hash::hash(_12, _state); - Hash::hash(_13, _state); - Hash::hash(_14, _state); - Hash::hash(_15, _state); - Hash::hash(_16, _state); - Hash::hash(_17, _state); - Hash::hash(_18, _state) - }, - } - } - } - - impl Default - for Tuple19 { - fn default() -> Tuple19 { - Tuple19::_T19 { - _0: Default::default(), - _1: Default::default(), - _2: Default::default(), - _3: Default::default(), - _4: Default::default(), - _5: Default::default(), - _6: Default::default(), - _7: Default::default(), - _8: Default::default(), - _9: Default::default(), - _10: Default::default(), - _11: Default::default(), - _12: Default::default(), - _13: Default::default(), - _14: Default::default(), - _15: Default::default(), - _16: Default::default(), - _17: Default::default(), - _18: Default::default() - } - } - } - - impl AsRef> - for Tuple19 { - fn as_ref(&self) -> &Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Tuple20 { - _T20 { - _0: T0, - _1: T1, - _2: T2, - _3: T3, - _4: T4, - _5: T5, - _6: T6, - _7: T7, - _8: T8, - _9: T9, - _10: T10, - _11: T11, - _12: T12, - _13: T13, - _14: T14, - _15: T15, - _16: T16, - _17: T17, - _18: T18, - _19: T19 - } - } - - impl Tuple20 { - pub fn _0(&self) -> &T0 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _0, - } - } - pub fn _1(&self) -> &T1 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _1, - } - } - pub fn _2(&self) -> &T2 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _2, - } - } - pub fn _3(&self) -> &T3 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _3, - } - } - pub fn _4(&self) -> &T4 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _4, - } - } - pub fn _5(&self) -> &T5 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _5, - } - } - pub fn _6(&self) -> &T6 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _6, - } - } - pub fn _7(&self) -> &T7 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _7, - } - } - pub fn _8(&self) -> &T8 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _8, - } - } - pub fn _9(&self) -> &T9 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _9, - } - } - pub fn _10(&self) -> &T10 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _10, - } - } - pub fn _11(&self) -> &T11 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _11, - } - } - pub fn _12(&self) -> &T12 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _12, - } - } - pub fn _13(&self) -> &T13 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _13, - } - } - pub fn _14(&self) -> &T14 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _14, - } - } - pub fn _15(&self) -> &T15 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _15, - } - } - pub fn _16(&self) -> &T16 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _16, - } - } - pub fn _17(&self) -> &T17 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _17, - } - } - pub fn _18(&self) -> &T18 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _18, - } - } - pub fn _19(&self) -> &T19 { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _19, - } - } - } - - impl Debug - for Tuple20 { - fn fmt(&self, f: &mut Formatter) -> Result { - DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Tuple20 { - fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => { - write!(_formatter, "(")?; - DafnyPrint::fmt_print(_0, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_1, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_2, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_3, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_4, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_5, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_6, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_7, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_8, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_9, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_10, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_11, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_12, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_13, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_14, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_15, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_16, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_17, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_18, _formatter, false)?; - write!(_formatter, ", ")?; - DafnyPrint::fmt_print(_19, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Tuple20 { - pub fn coerce(f_0: Rc r#__T0 + 'static>, f_1: Rc r#__T1 + 'static>, f_2: Rc r#__T2 + 'static>, f_3: Rc r#__T3 + 'static>, f_4: Rc r#__T4 + 'static>, f_5: Rc r#__T5 + 'static>, f_6: Rc r#__T6 + 'static>, f_7: Rc r#__T7 + 'static>, f_8: Rc r#__T8 + 'static>, f_9: Rc r#__T9 + 'static>, f_10: Rc r#__T10 + 'static>, f_11: Rc r#__T11 + 'static>, f_12: Rc r#__T12 + 'static>, f_13: Rc r#__T13 + 'static>, f_14: Rc r#__T14 + 'static>, f_15: Rc r#__T15 + 'static>, f_16: Rc r#__T16 + 'static>, f_17: Rc r#__T17 + 'static>, f_18: Rc r#__T18 + 'static>, f_19: Rc r#__T19 + 'static>) -> Rc) -> Tuple20> { - Rc::new(move |this: Self| -> Tuple20{ - match this { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => { - Tuple20::_T20 { - _0: f_0.clone()(_0), - _1: f_1.clone()(_1), - _2: f_2.clone()(_2), - _3: f_3.clone()(_3), - _4: f_4.clone()(_4), - _5: f_5.clone()(_5), - _6: f_6.clone()(_6), - _7: f_7.clone()(_7), - _8: f_8.clone()(_8), - _9: f_9.clone()(_9), - _10: f_10.clone()(_10), - _11: f_11.clone()(_11), - _12: f_12.clone()(_12), - _13: f_13.clone()(_13), - _14: f_14.clone()(_14), - _15: f_15.clone()(_15), - _16: f_16.clone()(_16), - _17: f_17.clone()(_17), - _18: f_18.clone()(_18), - _19: f_19.clone()(_19) - } - }, - } - }) - } - } - - impl Eq - for Tuple20 {} - - impl Hash - for Tuple20 { - fn hash<_H: Hasher>(&self, _state: &mut _H) { - match self { - Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => { - Hash::hash(_0, _state); - Hash::hash(_1, _state); - Hash::hash(_2, _state); - Hash::hash(_3, _state); - Hash::hash(_4, _state); - Hash::hash(_5, _state); - Hash::hash(_6, _state); - Hash::hash(_7, _state); - Hash::hash(_8, _state); - Hash::hash(_9, _state); - Hash::hash(_10, _state); - Hash::hash(_11, _state); - Hash::hash(_12, _state); - Hash::hash(_13, _state); - Hash::hash(_14, _state); - Hash::hash(_15, _state); - Hash::hash(_16, _state); - Hash::hash(_17, _state); - Hash::hash(_18, _state); - Hash::hash(_19, _state) - }, - } - } - } - - impl Default - for Tuple20 { - fn default() -> Tuple20 { - Tuple20::_T20 { - _0: Default::default(), - _1: Default::default(), - _2: Default::default(), - _3: Default::default(), - _4: Default::default(), - _5: Default::default(), - _6: Default::default(), - _7: Default::default(), - _8: Default::default(), - _9: Default::default(), - _10: Default::default(), - _11: Default::default(), - _12: Default::default(), - _13: Default::default(), - _14: Default::default(), - _15: Default::default(), - _16: Default::default(), - _17: Default::default(), - _18: Default::default(), - _19: Default::default() - } - } - } - - impl AsRef> - for Tuple20 { - fn as_ref(&self) -> &Self { - self - } - } + pub use crate::DafnyInt; + pub use crate::DafnyType; + pub use ::std::fmt::Debug; + pub use ::std::fmt::Formatter; + pub use ::std::fmt::Result; + pub use crate::DafnyPrint; + #[cfg(feature = "sync")] pub use ::std::sync::{Arc as Rc}; #[cfg(not(feature = "sync"))] pub use ::std::rc::Rc; + pub use ::std::cmp::Eq; + pub use ::std::hash::Hash; + pub use ::std::hash::Hasher; + pub use ::std::default::Default; + pub use ::std::convert::AsRef; + pub use crate::SequenceIter; + pub use crate::seq; + + pub type nat = DafnyInt; + + #[derive(PartialEq, Clone)] + pub enum Tuple2 { + _T2 { + _0: T0, + _1: T1 + } + } + + impl Tuple2 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple2::_T2{_0, _1, } => _0, + } + } + /// Returns a borrow of the field _1 + pub fn _1(&self) -> &T1 { + match self { + Tuple2::_T2{_0, _1, } => _1, + } + } + } + + impl Debug + for Tuple2 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple2 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple2::_T2{_0, _1, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_1, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple2 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType, __T1: DafnyType>(f_0: Rc __T0 + 'static>, f_1: Rc __T1 + 'static>) -> Rc) -> Tuple2<__T0, __T1>> { + Rc::new(move |this: Self| -> Tuple2<__T0, __T1>{ + match this { + Tuple2::_T2{_0, _1, } => { + Tuple2::_T2 { + _0: f_0.clone()(_0), + _1: f_1.clone()(_1) + } + }, + } + }) + } + } + + impl Eq + for Tuple2 {} + + impl Hash + for Tuple2 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple2::_T2{_0, _1, } => { + Hash::hash(_0, _state); + Hash::hash(_1, _state) + }, + } + } + } + + impl Default + for Tuple2 { + fn default() -> Tuple2 { + Tuple2::_T2 { + _0: Default::default(), + _1: Default::default() + } + } + } + + impl AsRef> + for Tuple2 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple0 { + _T0 {} + } + + impl Tuple0 {} + + impl Debug + for Tuple0 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple0 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple0::_T0{} => { + write!(_formatter, "")?; + Ok(()) + }, + } + } + } + + impl Tuple0 { + /// Enumerates all possible values of Tuple0 + pub fn _AllSingletonConstructors() -> SequenceIter> { + seq![Rc::new(Tuple0::_T0 {})].iter() + } + } + + impl Eq + for Tuple0 {} + + impl Hash + for Tuple0 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple0::_T0{} => { + + }, + } + } + } + + impl Default + for Tuple0 { + fn default() -> Tuple0 { + Tuple0::_T0 {} + } + } + + impl AsRef + for Tuple0 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple1 { + _T1 { + _0: T0 + } + } + + impl Tuple1 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple1::_T1{_0, } => _0, + } + } + } + + impl Debug + for Tuple1 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple1 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple1::_T1{_0, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple1 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType>(f_0: Rc __T0 + 'static>) -> Rc) -> Tuple1<__T0>> { + Rc::new(move |this: Self| -> Tuple1<__T0>{ + match this { + Tuple1::_T1{_0, } => { + Tuple1::_T1 { + _0: f_0.clone()(_0) + } + }, + } + }) + } + } + + impl Eq + for Tuple1 {} + + impl Hash + for Tuple1 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple1::_T1{_0, } => { + Hash::hash(_0, _state) + }, + } + } + } + + impl Default + for Tuple1 { + fn default() -> Tuple1 { + Tuple1::_T1 { + _0: Default::default() + } + } + } + + impl AsRef> + for Tuple1 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple3 { + _T3 { + _0: T0, + _1: T1, + _2: T2 + } + } + + impl Tuple3 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple3::_T3{_0, _1, _2, } => _0, + } + } + /// Returns a borrow of the field _1 + pub fn _1(&self) -> &T1 { + match self { + Tuple3::_T3{_0, _1, _2, } => _1, + } + } + /// Returns a borrow of the field _2 + pub fn _2(&self) -> &T2 { + match self { + Tuple3::_T3{_0, _1, _2, } => _2, + } + } + } + + impl Debug + for Tuple3 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple3 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple3::_T3{_0, _1, _2, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_1, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_2, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple3 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType, __T1: DafnyType, __T2: DafnyType>(f_0: Rc __T0 + 'static>, f_1: Rc __T1 + 'static>, f_2: Rc __T2 + 'static>) -> Rc) -> Tuple3<__T0, __T1, __T2>> { + Rc::new(move |this: Self| -> Tuple3<__T0, __T1, __T2>{ + match this { + Tuple3::_T3{_0, _1, _2, } => { + Tuple3::_T3 { + _0: f_0.clone()(_0), + _1: f_1.clone()(_1), + _2: f_2.clone()(_2) + } + }, + } + }) + } + } + + impl Eq + for Tuple3 {} + + impl Hash + for Tuple3 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple3::_T3{_0, _1, _2, } => { + Hash::hash(_0, _state); + Hash::hash(_1, _state); + Hash::hash(_2, _state) + }, + } + } + } + + impl Default + for Tuple3 { + fn default() -> Tuple3 { + Tuple3::_T3 { + _0: Default::default(), + _1: Default::default(), + _2: Default::default() + } + } + } + + impl AsRef> + for Tuple3 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple4 { + _T4 { + _0: T0, + _1: T1, + _2: T2, + _3: T3 + } + } + + impl Tuple4 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple4::_T4{_0, _1, _2, _3, } => _0, + } + } + /// Returns a borrow of the field _1 + pub fn _1(&self) -> &T1 { + match self { + Tuple4::_T4{_0, _1, _2, _3, } => _1, + } + } + /// Returns a borrow of the field _2 + pub fn _2(&self) -> &T2 { + match self { + Tuple4::_T4{_0, _1, _2, _3, } => _2, + } + } + /// Returns a borrow of the field _3 + pub fn _3(&self) -> &T3 { + match self { + Tuple4::_T4{_0, _1, _2, _3, } => _3, + } + } + } + + impl Debug + for Tuple4 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple4 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple4::_T4{_0, _1, _2, _3, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_1, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_2, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_3, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple4 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType, __T1: DafnyType, __T2: DafnyType, __T3: DafnyType>(f_0: Rc __T0 + 'static>, f_1: Rc __T1 + 'static>, f_2: Rc __T2 + 'static>, f_3: Rc __T3 + 'static>) -> Rc) -> Tuple4<__T0, __T1, __T2, __T3>> { + Rc::new(move |this: Self| -> Tuple4<__T0, __T1, __T2, __T3>{ + match this { + Tuple4::_T4{_0, _1, _2, _3, } => { + Tuple4::_T4 { + _0: f_0.clone()(_0), + _1: f_1.clone()(_1), + _2: f_2.clone()(_2), + _3: f_3.clone()(_3) + } + }, + } + }) + } + } + + impl Eq + for Tuple4 {} + + impl Hash + for Tuple4 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple4::_T4{_0, _1, _2, _3, } => { + Hash::hash(_0, _state); + Hash::hash(_1, _state); + Hash::hash(_2, _state); + Hash::hash(_3, _state) + }, + } + } + } + + impl Default + for Tuple4 { + fn default() -> Tuple4 { + Tuple4::_T4 { + _0: Default::default(), + _1: Default::default(), + _2: Default::default(), + _3: Default::default() + } + } + } + + impl AsRef> + for Tuple4 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple5 { + _T5 { + _0: T0, + _1: T1, + _2: T2, + _3: T3, + _4: T4 + } + } + + impl Tuple5 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple5::_T5{_0, _1, _2, _3, _4, } => _0, + } + } + /// Returns a borrow of the field _1 + pub fn _1(&self) -> &T1 { + match self { + Tuple5::_T5{_0, _1, _2, _3, _4, } => _1, + } + } + /// Returns a borrow of the field _2 + pub fn _2(&self) -> &T2 { + match self { + Tuple5::_T5{_0, _1, _2, _3, _4, } => _2, + } + } + /// Returns a borrow of the field _3 + pub fn _3(&self) -> &T3 { + match self { + Tuple5::_T5{_0, _1, _2, _3, _4, } => _3, + } + } + /// Returns a borrow of the field _4 + pub fn _4(&self) -> &T4 { + match self { + Tuple5::_T5{_0, _1, _2, _3, _4, } => _4, + } + } + } + + impl Debug + for Tuple5 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple5 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple5::_T5{_0, _1, _2, _3, _4, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_1, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_2, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_3, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_4, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple5 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType, __T1: DafnyType, __T2: DafnyType, __T3: DafnyType, __T4: DafnyType>(f_0: Rc __T0 + 'static>, f_1: Rc __T1 + 'static>, f_2: Rc __T2 + 'static>, f_3: Rc __T3 + 'static>, f_4: Rc __T4 + 'static>) -> Rc) -> Tuple5<__T0, __T1, __T2, __T3, __T4>> { + Rc::new(move |this: Self| -> Tuple5<__T0, __T1, __T2, __T3, __T4>{ + match this { + Tuple5::_T5{_0, _1, _2, _3, _4, } => { + Tuple5::_T5 { + _0: f_0.clone()(_0), + _1: f_1.clone()(_1), + _2: f_2.clone()(_2), + _3: f_3.clone()(_3), + _4: f_4.clone()(_4) + } + }, + } + }) + } + } + + impl Eq + for Tuple5 {} + + impl Hash + for Tuple5 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple5::_T5{_0, _1, _2, _3, _4, } => { + Hash::hash(_0, _state); + Hash::hash(_1, _state); + Hash::hash(_2, _state); + Hash::hash(_3, _state); + Hash::hash(_4, _state) + }, + } + } + } + + impl Default + for Tuple5 { + fn default() -> Tuple5 { + Tuple5::_T5 { + _0: Default::default(), + _1: Default::default(), + _2: Default::default(), + _3: Default::default(), + _4: Default::default() + } + } + } + + impl AsRef> + for Tuple5 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple6 { + _T6 { + _0: T0, + _1: T1, + _2: T2, + _3: T3, + _4: T4, + _5: T5 + } + } + + impl Tuple6 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple6::_T6{_0, _1, _2, _3, _4, _5, } => _0, + } + } + /// Returns a borrow of the field _1 + pub fn _1(&self) -> &T1 { + match self { + Tuple6::_T6{_0, _1, _2, _3, _4, _5, } => _1, + } + } + /// Returns a borrow of the field _2 + pub fn _2(&self) -> &T2 { + match self { + Tuple6::_T6{_0, _1, _2, _3, _4, _5, } => _2, + } + } + /// Returns a borrow of the field _3 + pub fn _3(&self) -> &T3 { + match self { + Tuple6::_T6{_0, _1, _2, _3, _4, _5, } => _3, + } + } + /// Returns a borrow of the field _4 + pub fn _4(&self) -> &T4 { + match self { + Tuple6::_T6{_0, _1, _2, _3, _4, _5, } => _4, + } + } + /// Returns a borrow of the field _5 + pub fn _5(&self) -> &T5 { + match self { + Tuple6::_T6{_0, _1, _2, _3, _4, _5, } => _5, + } + } + } + + impl Debug + for Tuple6 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple6 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple6::_T6{_0, _1, _2, _3, _4, _5, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_1, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_2, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_3, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_4, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_5, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple6 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType, __T1: DafnyType, __T2: DafnyType, __T3: DafnyType, __T4: DafnyType, __T5: DafnyType>(f_0: Rc __T0 + 'static>, f_1: Rc __T1 + 'static>, f_2: Rc __T2 + 'static>, f_3: Rc __T3 + 'static>, f_4: Rc __T4 + 'static>, f_5: Rc __T5 + 'static>) -> Rc) -> Tuple6<__T0, __T1, __T2, __T3, __T4, __T5>> { + Rc::new(move |this: Self| -> Tuple6<__T0, __T1, __T2, __T3, __T4, __T5>{ + match this { + Tuple6::_T6{_0, _1, _2, _3, _4, _5, } => { + Tuple6::_T6 { + _0: f_0.clone()(_0), + _1: f_1.clone()(_1), + _2: f_2.clone()(_2), + _3: f_3.clone()(_3), + _4: f_4.clone()(_4), + _5: f_5.clone()(_5) + } + }, + } + }) + } + } + + impl Eq + for Tuple6 {} + + impl Hash + for Tuple6 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple6::_T6{_0, _1, _2, _3, _4, _5, } => { + Hash::hash(_0, _state); + Hash::hash(_1, _state); + Hash::hash(_2, _state); + Hash::hash(_3, _state); + Hash::hash(_4, _state); + Hash::hash(_5, _state) + }, + } + } + } + + impl Default + for Tuple6 { + fn default() -> Tuple6 { + Tuple6::_T6 { + _0: Default::default(), + _1: Default::default(), + _2: Default::default(), + _3: Default::default(), + _4: Default::default(), + _5: Default::default() + } + } + } + + impl AsRef> + for Tuple6 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple7 { + _T7 { + _0: T0, + _1: T1, + _2: T2, + _3: T3, + _4: T4, + _5: T5, + _6: T6 + } + } + + impl Tuple7 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => _0, + } + } + /// Returns a borrow of the field _1 + pub fn _1(&self) -> &T1 { + match self { + Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => _1, + } + } + /// Returns a borrow of the field _2 + pub fn _2(&self) -> &T2 { + match self { + Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => _2, + } + } + /// Returns a borrow of the field _3 + pub fn _3(&self) -> &T3 { + match self { + Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => _3, + } + } + /// Returns a borrow of the field _4 + pub fn _4(&self) -> &T4 { + match self { + Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => _4, + } + } + /// Returns a borrow of the field _5 + pub fn _5(&self) -> &T5 { + match self { + Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => _5, + } + } + /// Returns a borrow of the field _6 + pub fn _6(&self) -> &T6 { + match self { + Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => _6, + } + } + } + + impl Debug + for Tuple7 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple7 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_1, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_2, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_3, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_4, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_5, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_6, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple7 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType, __T1: DafnyType, __T2: DafnyType, __T3: DafnyType, __T4: DafnyType, __T5: DafnyType, __T6: DafnyType>(f_0: Rc __T0 + 'static>, f_1: Rc __T1 + 'static>, f_2: Rc __T2 + 'static>, f_3: Rc __T3 + 'static>, f_4: Rc __T4 + 'static>, f_5: Rc __T5 + 'static>, f_6: Rc __T6 + 'static>) -> Rc) -> Tuple7<__T0, __T1, __T2, __T3, __T4, __T5, __T6>> { + Rc::new(move |this: Self| -> Tuple7<__T0, __T1, __T2, __T3, __T4, __T5, __T6>{ + match this { + Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => { + Tuple7::_T7 { + _0: f_0.clone()(_0), + _1: f_1.clone()(_1), + _2: f_2.clone()(_2), + _3: f_3.clone()(_3), + _4: f_4.clone()(_4), + _5: f_5.clone()(_5), + _6: f_6.clone()(_6) + } + }, + } + }) + } + } + + impl Eq + for Tuple7 {} + + impl Hash + for Tuple7 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple7::_T7{_0, _1, _2, _3, _4, _5, _6, } => { + Hash::hash(_0, _state); + Hash::hash(_1, _state); + Hash::hash(_2, _state); + Hash::hash(_3, _state); + Hash::hash(_4, _state); + Hash::hash(_5, _state); + Hash::hash(_6, _state) + }, + } + } + } + + impl Default + for Tuple7 { + fn default() -> Tuple7 { + Tuple7::_T7 { + _0: Default::default(), + _1: Default::default(), + _2: Default::default(), + _3: Default::default(), + _4: Default::default(), + _5: Default::default(), + _6: Default::default() + } + } + } + + impl AsRef> + for Tuple7 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple8 { + _T8 { + _0: T0, + _1: T1, + _2: T2, + _3: T3, + _4: T4, + _5: T5, + _6: T6, + _7: T7 + } + } + + impl Tuple8 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => _0, + } + } + /// Returns a borrow of the field _1 + pub fn _1(&self) -> &T1 { + match self { + Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => _1, + } + } + /// Returns a borrow of the field _2 + pub fn _2(&self) -> &T2 { + match self { + Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => _2, + } + } + /// Returns a borrow of the field _3 + pub fn _3(&self) -> &T3 { + match self { + Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => _3, + } + } + /// Returns a borrow of the field _4 + pub fn _4(&self) -> &T4 { + match self { + Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => _4, + } + } + /// Returns a borrow of the field _5 + pub fn _5(&self) -> &T5 { + match self { + Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => _5, + } + } + /// Returns a borrow of the field _6 + pub fn _6(&self) -> &T6 { + match self { + Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => _6, + } + } + /// Returns a borrow of the field _7 + pub fn _7(&self) -> &T7 { + match self { + Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => _7, + } + } + } + + impl Debug + for Tuple8 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple8 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_1, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_2, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_3, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_4, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_5, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_6, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_7, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple8 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType, __T1: DafnyType, __T2: DafnyType, __T3: DafnyType, __T4: DafnyType, __T5: DafnyType, __T6: DafnyType, __T7: DafnyType>(f_0: Rc __T0 + 'static>, f_1: Rc __T1 + 'static>, f_2: Rc __T2 + 'static>, f_3: Rc __T3 + 'static>, f_4: Rc __T4 + 'static>, f_5: Rc __T5 + 'static>, f_6: Rc __T6 + 'static>, f_7: Rc __T7 + 'static>) -> Rc) -> Tuple8<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7>> { + Rc::new(move |this: Self| -> Tuple8<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7>{ + match this { + Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => { + Tuple8::_T8 { + _0: f_0.clone()(_0), + _1: f_1.clone()(_1), + _2: f_2.clone()(_2), + _3: f_3.clone()(_3), + _4: f_4.clone()(_4), + _5: f_5.clone()(_5), + _6: f_6.clone()(_6), + _7: f_7.clone()(_7) + } + }, + } + }) + } + } + + impl Eq + for Tuple8 {} + + impl Hash + for Tuple8 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple8::_T8{_0, _1, _2, _3, _4, _5, _6, _7, } => { + Hash::hash(_0, _state); + Hash::hash(_1, _state); + Hash::hash(_2, _state); + Hash::hash(_3, _state); + Hash::hash(_4, _state); + Hash::hash(_5, _state); + Hash::hash(_6, _state); + Hash::hash(_7, _state) + }, + } + } + } + + impl Default + for Tuple8 { + fn default() -> Tuple8 { + Tuple8::_T8 { + _0: Default::default(), + _1: Default::default(), + _2: Default::default(), + _3: Default::default(), + _4: Default::default(), + _5: Default::default(), + _6: Default::default(), + _7: Default::default() + } + } + } + + impl AsRef> + for Tuple8 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple9 { + _T9 { + _0: T0, + _1: T1, + _2: T2, + _3: T3, + _4: T4, + _5: T5, + _6: T6, + _7: T7, + _8: T8 + } + } + + impl Tuple9 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => _0, + } + } + /// Returns a borrow of the field _1 + pub fn _1(&self) -> &T1 { + match self { + Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => _1, + } + } + /// Returns a borrow of the field _2 + pub fn _2(&self) -> &T2 { + match self { + Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => _2, + } + } + /// Returns a borrow of the field _3 + pub fn _3(&self) -> &T3 { + match self { + Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => _3, + } + } + /// Returns a borrow of the field _4 + pub fn _4(&self) -> &T4 { + match self { + Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => _4, + } + } + /// Returns a borrow of the field _5 + pub fn _5(&self) -> &T5 { + match self { + Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => _5, + } + } + /// Returns a borrow of the field _6 + pub fn _6(&self) -> &T6 { + match self { + Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => _6, + } + } + /// Returns a borrow of the field _7 + pub fn _7(&self) -> &T7 { + match self { + Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => _7, + } + } + /// Returns a borrow of the field _8 + pub fn _8(&self) -> &T8 { + match self { + Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => _8, + } + } + } + + impl Debug + for Tuple9 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple9 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_1, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_2, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_3, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_4, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_5, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_6, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_7, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_8, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple9 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType, __T1: DafnyType, __T2: DafnyType, __T3: DafnyType, __T4: DafnyType, __T5: DafnyType, __T6: DafnyType, __T7: DafnyType, __T8: DafnyType>(f_0: Rc __T0 + 'static>, f_1: Rc __T1 + 'static>, f_2: Rc __T2 + 'static>, f_3: Rc __T3 + 'static>, f_4: Rc __T4 + 'static>, f_5: Rc __T5 + 'static>, f_6: Rc __T6 + 'static>, f_7: Rc __T7 + 'static>, f_8: Rc __T8 + 'static>) -> Rc) -> Tuple9<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8>> { + Rc::new(move |this: Self| -> Tuple9<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8>{ + match this { + Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => { + Tuple9::_T9 { + _0: f_0.clone()(_0), + _1: f_1.clone()(_1), + _2: f_2.clone()(_2), + _3: f_3.clone()(_3), + _4: f_4.clone()(_4), + _5: f_5.clone()(_5), + _6: f_6.clone()(_6), + _7: f_7.clone()(_7), + _8: f_8.clone()(_8) + } + }, + } + }) + } + } + + impl Eq + for Tuple9 {} + + impl Hash + for Tuple9 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple9::_T9{_0, _1, _2, _3, _4, _5, _6, _7, _8, } => { + Hash::hash(_0, _state); + Hash::hash(_1, _state); + Hash::hash(_2, _state); + Hash::hash(_3, _state); + Hash::hash(_4, _state); + Hash::hash(_5, _state); + Hash::hash(_6, _state); + Hash::hash(_7, _state); + Hash::hash(_8, _state) + }, + } + } + } + + impl Default + for Tuple9 { + fn default() -> Tuple9 { + Tuple9::_T9 { + _0: Default::default(), + _1: Default::default(), + _2: Default::default(), + _3: Default::default(), + _4: Default::default(), + _5: Default::default(), + _6: Default::default(), + _7: Default::default(), + _8: Default::default() + } + } + } + + impl AsRef> + for Tuple9 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple10 { + _T10 { + _0: T0, + _1: T1, + _2: T2, + _3: T3, + _4: T4, + _5: T5, + _6: T6, + _7: T7, + _8: T8, + _9: T9 + } + } + + impl Tuple10 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _0, + } + } + /// Returns a borrow of the field _1 + pub fn _1(&self) -> &T1 { + match self { + Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _1, + } + } + /// Returns a borrow of the field _2 + pub fn _2(&self) -> &T2 { + match self { + Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _2, + } + } + /// Returns a borrow of the field _3 + pub fn _3(&self) -> &T3 { + match self { + Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _3, + } + } + /// Returns a borrow of the field _4 + pub fn _4(&self) -> &T4 { + match self { + Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _4, + } + } + /// Returns a borrow of the field _5 + pub fn _5(&self) -> &T5 { + match self { + Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _5, + } + } + /// Returns a borrow of the field _6 + pub fn _6(&self) -> &T6 { + match self { + Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _6, + } + } + /// Returns a borrow of the field _7 + pub fn _7(&self) -> &T7 { + match self { + Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _7, + } + } + /// Returns a borrow of the field _8 + pub fn _8(&self) -> &T8 { + match self { + Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _8, + } + } + /// Returns a borrow of the field _9 + pub fn _9(&self) -> &T9 { + match self { + Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => _9, + } + } + } + + impl Debug + for Tuple10 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple10 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_1, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_2, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_3, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_4, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_5, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_6, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_7, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_8, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_9, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple10 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType, __T1: DafnyType, __T2: DafnyType, __T3: DafnyType, __T4: DafnyType, __T5: DafnyType, __T6: DafnyType, __T7: DafnyType, __T8: DafnyType, __T9: DafnyType>(f_0: Rc __T0 + 'static>, f_1: Rc __T1 + 'static>, f_2: Rc __T2 + 'static>, f_3: Rc __T3 + 'static>, f_4: Rc __T4 + 'static>, f_5: Rc __T5 + 'static>, f_6: Rc __T6 + 'static>, f_7: Rc __T7 + 'static>, f_8: Rc __T8 + 'static>, f_9: Rc __T9 + 'static>) -> Rc) -> Tuple10<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9>> { + Rc::new(move |this: Self| -> Tuple10<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9>{ + match this { + Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => { + Tuple10::_T10 { + _0: f_0.clone()(_0), + _1: f_1.clone()(_1), + _2: f_2.clone()(_2), + _3: f_3.clone()(_3), + _4: f_4.clone()(_4), + _5: f_5.clone()(_5), + _6: f_6.clone()(_6), + _7: f_7.clone()(_7), + _8: f_8.clone()(_8), + _9: f_9.clone()(_9) + } + }, + } + }) + } + } + + impl Eq + for Tuple10 {} + + impl Hash + for Tuple10 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple10::_T10{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, } => { + Hash::hash(_0, _state); + Hash::hash(_1, _state); + Hash::hash(_2, _state); + Hash::hash(_3, _state); + Hash::hash(_4, _state); + Hash::hash(_5, _state); + Hash::hash(_6, _state); + Hash::hash(_7, _state); + Hash::hash(_8, _state); + Hash::hash(_9, _state) + }, + } + } + } + + impl Default + for Tuple10 { + fn default() -> Tuple10 { + Tuple10::_T10 { + _0: Default::default(), + _1: Default::default(), + _2: Default::default(), + _3: Default::default(), + _4: Default::default(), + _5: Default::default(), + _6: Default::default(), + _7: Default::default(), + _8: Default::default(), + _9: Default::default() + } + } + } + + impl AsRef> + for Tuple10 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple11 { + _T11 { + _0: T0, + _1: T1, + _2: T2, + _3: T3, + _4: T4, + _5: T5, + _6: T6, + _7: T7, + _8: T8, + _9: T9, + _10: T10 + } + } + + impl Tuple11 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _0, + } + } + /// Returns a borrow of the field _1 + pub fn _1(&self) -> &T1 { + match self { + Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _1, + } + } + /// Returns a borrow of the field _2 + pub fn _2(&self) -> &T2 { + match self { + Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _2, + } + } + /// Returns a borrow of the field _3 + pub fn _3(&self) -> &T3 { + match self { + Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _3, + } + } + /// Returns a borrow of the field _4 + pub fn _4(&self) -> &T4 { + match self { + Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _4, + } + } + /// Returns a borrow of the field _5 + pub fn _5(&self) -> &T5 { + match self { + Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _5, + } + } + /// Returns a borrow of the field _6 + pub fn _6(&self) -> &T6 { + match self { + Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _6, + } + } + /// Returns a borrow of the field _7 + pub fn _7(&self) -> &T7 { + match self { + Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _7, + } + } + /// Returns a borrow of the field _8 + pub fn _8(&self) -> &T8 { + match self { + Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _8, + } + } + /// Returns a borrow of the field _9 + pub fn _9(&self) -> &T9 { + match self { + Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _9, + } + } + /// Returns a borrow of the field _10 + pub fn _10(&self) -> &T10 { + match self { + Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => _10, + } + } + } + + impl Debug + for Tuple11 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple11 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_1, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_2, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_3, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_4, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_5, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_6, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_7, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_8, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_9, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_10, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple11 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType, __T1: DafnyType, __T2: DafnyType, __T3: DafnyType, __T4: DafnyType, __T5: DafnyType, __T6: DafnyType, __T7: DafnyType, __T8: DafnyType, __T9: DafnyType, __T10: DafnyType>(f_0: Rc __T0 + 'static>, f_1: Rc __T1 + 'static>, f_2: Rc __T2 + 'static>, f_3: Rc __T3 + 'static>, f_4: Rc __T4 + 'static>, f_5: Rc __T5 + 'static>, f_6: Rc __T6 + 'static>, f_7: Rc __T7 + 'static>, f_8: Rc __T8 + 'static>, f_9: Rc __T9 + 'static>, f_10: Rc __T10 + 'static>) -> Rc) -> Tuple11<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10>> { + Rc::new(move |this: Self| -> Tuple11<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10>{ + match this { + Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => { + Tuple11::_T11 { + _0: f_0.clone()(_0), + _1: f_1.clone()(_1), + _2: f_2.clone()(_2), + _3: f_3.clone()(_3), + _4: f_4.clone()(_4), + _5: f_5.clone()(_5), + _6: f_6.clone()(_6), + _7: f_7.clone()(_7), + _8: f_8.clone()(_8), + _9: f_9.clone()(_9), + _10: f_10.clone()(_10) + } + }, + } + }) + } + } + + impl Eq + for Tuple11 {} + + impl Hash + for Tuple11 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple11::_T11{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, } => { + Hash::hash(_0, _state); + Hash::hash(_1, _state); + Hash::hash(_2, _state); + Hash::hash(_3, _state); + Hash::hash(_4, _state); + Hash::hash(_5, _state); + Hash::hash(_6, _state); + Hash::hash(_7, _state); + Hash::hash(_8, _state); + Hash::hash(_9, _state); + Hash::hash(_10, _state) + }, + } + } + } + + impl Default + for Tuple11 { + fn default() -> Tuple11 { + Tuple11::_T11 { + _0: Default::default(), + _1: Default::default(), + _2: Default::default(), + _3: Default::default(), + _4: Default::default(), + _5: Default::default(), + _6: Default::default(), + _7: Default::default(), + _8: Default::default(), + _9: Default::default(), + _10: Default::default() + } + } + } + + impl AsRef> + for Tuple11 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple12 { + _T12 { + _0: T0, + _1: T1, + _2: T2, + _3: T3, + _4: T4, + _5: T5, + _6: T6, + _7: T7, + _8: T8, + _9: T9, + _10: T10, + _11: T11 + } + } + + impl Tuple12 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _0, + } + } + /// Returns a borrow of the field _1 + pub fn _1(&self) -> &T1 { + match self { + Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _1, + } + } + /// Returns a borrow of the field _2 + pub fn _2(&self) -> &T2 { + match self { + Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _2, + } + } + /// Returns a borrow of the field _3 + pub fn _3(&self) -> &T3 { + match self { + Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _3, + } + } + /// Returns a borrow of the field _4 + pub fn _4(&self) -> &T4 { + match self { + Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _4, + } + } + /// Returns a borrow of the field _5 + pub fn _5(&self) -> &T5 { + match self { + Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _5, + } + } + /// Returns a borrow of the field _6 + pub fn _6(&self) -> &T6 { + match self { + Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _6, + } + } + /// Returns a borrow of the field _7 + pub fn _7(&self) -> &T7 { + match self { + Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _7, + } + } + /// Returns a borrow of the field _8 + pub fn _8(&self) -> &T8 { + match self { + Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _8, + } + } + /// Returns a borrow of the field _9 + pub fn _9(&self) -> &T9 { + match self { + Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _9, + } + } + /// Returns a borrow of the field _10 + pub fn _10(&self) -> &T10 { + match self { + Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _10, + } + } + /// Returns a borrow of the field _11 + pub fn _11(&self) -> &T11 { + match self { + Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => _11, + } + } + } + + impl Debug + for Tuple12 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple12 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_1, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_2, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_3, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_4, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_5, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_6, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_7, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_8, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_9, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_10, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_11, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple12 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType, __T1: DafnyType, __T2: DafnyType, __T3: DafnyType, __T4: DafnyType, __T5: DafnyType, __T6: DafnyType, __T7: DafnyType, __T8: DafnyType, __T9: DafnyType, __T10: DafnyType, __T11: DafnyType>(f_0: Rc __T0 + 'static>, f_1: Rc __T1 + 'static>, f_2: Rc __T2 + 'static>, f_3: Rc __T3 + 'static>, f_4: Rc __T4 + 'static>, f_5: Rc __T5 + 'static>, f_6: Rc __T6 + 'static>, f_7: Rc __T7 + 'static>, f_8: Rc __T8 + 'static>, f_9: Rc __T9 + 'static>, f_10: Rc __T10 + 'static>, f_11: Rc __T11 + 'static>) -> Rc) -> Tuple12<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10, __T11>> { + Rc::new(move |this: Self| -> Tuple12<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10, __T11>{ + match this { + Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => { + Tuple12::_T12 { + _0: f_0.clone()(_0), + _1: f_1.clone()(_1), + _2: f_2.clone()(_2), + _3: f_3.clone()(_3), + _4: f_4.clone()(_4), + _5: f_5.clone()(_5), + _6: f_6.clone()(_6), + _7: f_7.clone()(_7), + _8: f_8.clone()(_8), + _9: f_9.clone()(_9), + _10: f_10.clone()(_10), + _11: f_11.clone()(_11) + } + }, + } + }) + } + } + + impl Eq + for Tuple12 {} + + impl Hash + for Tuple12 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple12::_T12{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, } => { + Hash::hash(_0, _state); + Hash::hash(_1, _state); + Hash::hash(_2, _state); + Hash::hash(_3, _state); + Hash::hash(_4, _state); + Hash::hash(_5, _state); + Hash::hash(_6, _state); + Hash::hash(_7, _state); + Hash::hash(_8, _state); + Hash::hash(_9, _state); + Hash::hash(_10, _state); + Hash::hash(_11, _state) + }, + } + } + } + + impl Default + for Tuple12 { + fn default() -> Tuple12 { + Tuple12::_T12 { + _0: Default::default(), + _1: Default::default(), + _2: Default::default(), + _3: Default::default(), + _4: Default::default(), + _5: Default::default(), + _6: Default::default(), + _7: Default::default(), + _8: Default::default(), + _9: Default::default(), + _10: Default::default(), + _11: Default::default() + } + } + } + + impl AsRef> + for Tuple12 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple13 { + _T13 { + _0: T0, + _1: T1, + _2: T2, + _3: T3, + _4: T4, + _5: T5, + _6: T6, + _7: T7, + _8: T8, + _9: T9, + _10: T10, + _11: T11, + _12: T12 + } + } + + impl Tuple13 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _0, + } + } + /// Returns a borrow of the field _1 + pub fn _1(&self) -> &T1 { + match self { + Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _1, + } + } + /// Returns a borrow of the field _2 + pub fn _2(&self) -> &T2 { + match self { + Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _2, + } + } + /// Returns a borrow of the field _3 + pub fn _3(&self) -> &T3 { + match self { + Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _3, + } + } + /// Returns a borrow of the field _4 + pub fn _4(&self) -> &T4 { + match self { + Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _4, + } + } + /// Returns a borrow of the field _5 + pub fn _5(&self) -> &T5 { + match self { + Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _5, + } + } + /// Returns a borrow of the field _6 + pub fn _6(&self) -> &T6 { + match self { + Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _6, + } + } + /// Returns a borrow of the field _7 + pub fn _7(&self) -> &T7 { + match self { + Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _7, + } + } + /// Returns a borrow of the field _8 + pub fn _8(&self) -> &T8 { + match self { + Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _8, + } + } + /// Returns a borrow of the field _9 + pub fn _9(&self) -> &T9 { + match self { + Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _9, + } + } + /// Returns a borrow of the field _10 + pub fn _10(&self) -> &T10 { + match self { + Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _10, + } + } + /// Returns a borrow of the field _11 + pub fn _11(&self) -> &T11 { + match self { + Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _11, + } + } + /// Returns a borrow of the field _12 + pub fn _12(&self) -> &T12 { + match self { + Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => _12, + } + } + } + + impl Debug + for Tuple13 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple13 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_1, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_2, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_3, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_4, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_5, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_6, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_7, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_8, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_9, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_10, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_11, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_12, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple13 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType, __T1: DafnyType, __T2: DafnyType, __T3: DafnyType, __T4: DafnyType, __T5: DafnyType, __T6: DafnyType, __T7: DafnyType, __T8: DafnyType, __T9: DafnyType, __T10: DafnyType, __T11: DafnyType, __T12: DafnyType>(f_0: Rc __T0 + 'static>, f_1: Rc __T1 + 'static>, f_2: Rc __T2 + 'static>, f_3: Rc __T3 + 'static>, f_4: Rc __T4 + 'static>, f_5: Rc __T5 + 'static>, f_6: Rc __T6 + 'static>, f_7: Rc __T7 + 'static>, f_8: Rc __T8 + 'static>, f_9: Rc __T9 + 'static>, f_10: Rc __T10 + 'static>, f_11: Rc __T11 + 'static>, f_12: Rc __T12 + 'static>) -> Rc) -> Tuple13<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10, __T11, __T12>> { + Rc::new(move |this: Self| -> Tuple13<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10, __T11, __T12>{ + match this { + Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => { + Tuple13::_T13 { + _0: f_0.clone()(_0), + _1: f_1.clone()(_1), + _2: f_2.clone()(_2), + _3: f_3.clone()(_3), + _4: f_4.clone()(_4), + _5: f_5.clone()(_5), + _6: f_6.clone()(_6), + _7: f_7.clone()(_7), + _8: f_8.clone()(_8), + _9: f_9.clone()(_9), + _10: f_10.clone()(_10), + _11: f_11.clone()(_11), + _12: f_12.clone()(_12) + } + }, + } + }) + } + } + + impl Eq + for Tuple13 {} + + impl Hash + for Tuple13 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple13::_T13{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, } => { + Hash::hash(_0, _state); + Hash::hash(_1, _state); + Hash::hash(_2, _state); + Hash::hash(_3, _state); + Hash::hash(_4, _state); + Hash::hash(_5, _state); + Hash::hash(_6, _state); + Hash::hash(_7, _state); + Hash::hash(_8, _state); + Hash::hash(_9, _state); + Hash::hash(_10, _state); + Hash::hash(_11, _state); + Hash::hash(_12, _state) + }, + } + } + } + + impl Default + for Tuple13 { + fn default() -> Tuple13 { + Tuple13::_T13 { + _0: Default::default(), + _1: Default::default(), + _2: Default::default(), + _3: Default::default(), + _4: Default::default(), + _5: Default::default(), + _6: Default::default(), + _7: Default::default(), + _8: Default::default(), + _9: Default::default(), + _10: Default::default(), + _11: Default::default(), + _12: Default::default() + } + } + } + + impl AsRef> + for Tuple13 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple14 { + _T14 { + _0: T0, + _1: T1, + _2: T2, + _3: T3, + _4: T4, + _5: T5, + _6: T6, + _7: T7, + _8: T8, + _9: T9, + _10: T10, + _11: T11, + _12: T12, + _13: T13 + } + } + + impl Tuple14 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _0, + } + } + /// Returns a borrow of the field _1 + pub fn _1(&self) -> &T1 { + match self { + Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _1, + } + } + /// Returns a borrow of the field _2 + pub fn _2(&self) -> &T2 { + match self { + Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _2, + } + } + /// Returns a borrow of the field _3 + pub fn _3(&self) -> &T3 { + match self { + Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _3, + } + } + /// Returns a borrow of the field _4 + pub fn _4(&self) -> &T4 { + match self { + Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _4, + } + } + /// Returns a borrow of the field _5 + pub fn _5(&self) -> &T5 { + match self { + Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _5, + } + } + /// Returns a borrow of the field _6 + pub fn _6(&self) -> &T6 { + match self { + Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _6, + } + } + /// Returns a borrow of the field _7 + pub fn _7(&self) -> &T7 { + match self { + Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _7, + } + } + /// Returns a borrow of the field _8 + pub fn _8(&self) -> &T8 { + match self { + Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _8, + } + } + /// Returns a borrow of the field _9 + pub fn _9(&self) -> &T9 { + match self { + Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _9, + } + } + /// Returns a borrow of the field _10 + pub fn _10(&self) -> &T10 { + match self { + Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _10, + } + } + /// Returns a borrow of the field _11 + pub fn _11(&self) -> &T11 { + match self { + Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _11, + } + } + /// Returns a borrow of the field _12 + pub fn _12(&self) -> &T12 { + match self { + Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _12, + } + } + /// Returns a borrow of the field _13 + pub fn _13(&self) -> &T13 { + match self { + Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => _13, + } + } + } + + impl Debug + for Tuple14 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple14 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_1, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_2, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_3, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_4, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_5, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_6, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_7, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_8, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_9, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_10, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_11, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_12, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_13, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple14 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType, __T1: DafnyType, __T2: DafnyType, __T3: DafnyType, __T4: DafnyType, __T5: DafnyType, __T6: DafnyType, __T7: DafnyType, __T8: DafnyType, __T9: DafnyType, __T10: DafnyType, __T11: DafnyType, __T12: DafnyType, __T13: DafnyType>(f_0: Rc __T0 + 'static>, f_1: Rc __T1 + 'static>, f_2: Rc __T2 + 'static>, f_3: Rc __T3 + 'static>, f_4: Rc __T4 + 'static>, f_5: Rc __T5 + 'static>, f_6: Rc __T6 + 'static>, f_7: Rc __T7 + 'static>, f_8: Rc __T8 + 'static>, f_9: Rc __T9 + 'static>, f_10: Rc __T10 + 'static>, f_11: Rc __T11 + 'static>, f_12: Rc __T12 + 'static>, f_13: Rc __T13 + 'static>) -> Rc) -> Tuple14<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10, __T11, __T12, __T13>> { + Rc::new(move |this: Self| -> Tuple14<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10, __T11, __T12, __T13>{ + match this { + Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => { + Tuple14::_T14 { + _0: f_0.clone()(_0), + _1: f_1.clone()(_1), + _2: f_2.clone()(_2), + _3: f_3.clone()(_3), + _4: f_4.clone()(_4), + _5: f_5.clone()(_5), + _6: f_6.clone()(_6), + _7: f_7.clone()(_7), + _8: f_8.clone()(_8), + _9: f_9.clone()(_9), + _10: f_10.clone()(_10), + _11: f_11.clone()(_11), + _12: f_12.clone()(_12), + _13: f_13.clone()(_13) + } + }, + } + }) + } + } + + impl Eq + for Tuple14 {} + + impl Hash + for Tuple14 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple14::_T14{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, } => { + Hash::hash(_0, _state); + Hash::hash(_1, _state); + Hash::hash(_2, _state); + Hash::hash(_3, _state); + Hash::hash(_4, _state); + Hash::hash(_5, _state); + Hash::hash(_6, _state); + Hash::hash(_7, _state); + Hash::hash(_8, _state); + Hash::hash(_9, _state); + Hash::hash(_10, _state); + Hash::hash(_11, _state); + Hash::hash(_12, _state); + Hash::hash(_13, _state) + }, + } + } + } + + impl Default + for Tuple14 { + fn default() -> Tuple14 { + Tuple14::_T14 { + _0: Default::default(), + _1: Default::default(), + _2: Default::default(), + _3: Default::default(), + _4: Default::default(), + _5: Default::default(), + _6: Default::default(), + _7: Default::default(), + _8: Default::default(), + _9: Default::default(), + _10: Default::default(), + _11: Default::default(), + _12: Default::default(), + _13: Default::default() + } + } + } + + impl AsRef> + for Tuple14 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple15 { + _T15 { + _0: T0, + _1: T1, + _2: T2, + _3: T3, + _4: T4, + _5: T5, + _6: T6, + _7: T7, + _8: T8, + _9: T9, + _10: T10, + _11: T11, + _12: T12, + _13: T13, + _14: T14 + } + } + + impl Tuple15 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _0, + } + } + /// Returns a borrow of the field _1 + pub fn _1(&self) -> &T1 { + match self { + Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _1, + } + } + /// Returns a borrow of the field _2 + pub fn _2(&self) -> &T2 { + match self { + Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _2, + } + } + /// Returns a borrow of the field _3 + pub fn _3(&self) -> &T3 { + match self { + Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _3, + } + } + /// Returns a borrow of the field _4 + pub fn _4(&self) -> &T4 { + match self { + Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _4, + } + } + /// Returns a borrow of the field _5 + pub fn _5(&self) -> &T5 { + match self { + Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _5, + } + } + /// Returns a borrow of the field _6 + pub fn _6(&self) -> &T6 { + match self { + Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _6, + } + } + /// Returns a borrow of the field _7 + pub fn _7(&self) -> &T7 { + match self { + Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _7, + } + } + /// Returns a borrow of the field _8 + pub fn _8(&self) -> &T8 { + match self { + Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _8, + } + } + /// Returns a borrow of the field _9 + pub fn _9(&self) -> &T9 { + match self { + Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _9, + } + } + /// Returns a borrow of the field _10 + pub fn _10(&self) -> &T10 { + match self { + Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _10, + } + } + /// Returns a borrow of the field _11 + pub fn _11(&self) -> &T11 { + match self { + Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _11, + } + } + /// Returns a borrow of the field _12 + pub fn _12(&self) -> &T12 { + match self { + Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _12, + } + } + /// Returns a borrow of the field _13 + pub fn _13(&self) -> &T13 { + match self { + Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _13, + } + } + /// Returns a borrow of the field _14 + pub fn _14(&self) -> &T14 { + match self { + Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => _14, + } + } + } + + impl Debug + for Tuple15 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple15 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_1, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_2, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_3, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_4, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_5, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_6, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_7, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_8, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_9, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_10, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_11, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_12, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_13, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_14, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple15 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType, __T1: DafnyType, __T2: DafnyType, __T3: DafnyType, __T4: DafnyType, __T5: DafnyType, __T6: DafnyType, __T7: DafnyType, __T8: DafnyType, __T9: DafnyType, __T10: DafnyType, __T11: DafnyType, __T12: DafnyType, __T13: DafnyType, __T14: DafnyType>(f_0: Rc __T0 + 'static>, f_1: Rc __T1 + 'static>, f_2: Rc __T2 + 'static>, f_3: Rc __T3 + 'static>, f_4: Rc __T4 + 'static>, f_5: Rc __T5 + 'static>, f_6: Rc __T6 + 'static>, f_7: Rc __T7 + 'static>, f_8: Rc __T8 + 'static>, f_9: Rc __T9 + 'static>, f_10: Rc __T10 + 'static>, f_11: Rc __T11 + 'static>, f_12: Rc __T12 + 'static>, f_13: Rc __T13 + 'static>, f_14: Rc __T14 + 'static>) -> Rc) -> Tuple15<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10, __T11, __T12, __T13, __T14>> { + Rc::new(move |this: Self| -> Tuple15<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10, __T11, __T12, __T13, __T14>{ + match this { + Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => { + Tuple15::_T15 { + _0: f_0.clone()(_0), + _1: f_1.clone()(_1), + _2: f_2.clone()(_2), + _3: f_3.clone()(_3), + _4: f_4.clone()(_4), + _5: f_5.clone()(_5), + _6: f_6.clone()(_6), + _7: f_7.clone()(_7), + _8: f_8.clone()(_8), + _9: f_9.clone()(_9), + _10: f_10.clone()(_10), + _11: f_11.clone()(_11), + _12: f_12.clone()(_12), + _13: f_13.clone()(_13), + _14: f_14.clone()(_14) + } + }, + } + }) + } + } + + impl Eq + for Tuple15 {} + + impl Hash + for Tuple15 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple15::_T15{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, } => { + Hash::hash(_0, _state); + Hash::hash(_1, _state); + Hash::hash(_2, _state); + Hash::hash(_3, _state); + Hash::hash(_4, _state); + Hash::hash(_5, _state); + Hash::hash(_6, _state); + Hash::hash(_7, _state); + Hash::hash(_8, _state); + Hash::hash(_9, _state); + Hash::hash(_10, _state); + Hash::hash(_11, _state); + Hash::hash(_12, _state); + Hash::hash(_13, _state); + Hash::hash(_14, _state) + }, + } + } + } + + impl Default + for Tuple15 { + fn default() -> Tuple15 { + Tuple15::_T15 { + _0: Default::default(), + _1: Default::default(), + _2: Default::default(), + _3: Default::default(), + _4: Default::default(), + _5: Default::default(), + _6: Default::default(), + _7: Default::default(), + _8: Default::default(), + _9: Default::default(), + _10: Default::default(), + _11: Default::default(), + _12: Default::default(), + _13: Default::default(), + _14: Default::default() + } + } + } + + impl AsRef> + for Tuple15 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple16 { + _T16 { + _0: T0, + _1: T1, + _2: T2, + _3: T3, + _4: T4, + _5: T5, + _6: T6, + _7: T7, + _8: T8, + _9: T9, + _10: T10, + _11: T11, + _12: T12, + _13: T13, + _14: T14, + _15: T15 + } + } + + impl Tuple16 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _0, + } + } + /// Returns a borrow of the field _1 + pub fn _1(&self) -> &T1 { + match self { + Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _1, + } + } + /// Returns a borrow of the field _2 + pub fn _2(&self) -> &T2 { + match self { + Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _2, + } + } + /// Returns a borrow of the field _3 + pub fn _3(&self) -> &T3 { + match self { + Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _3, + } + } + /// Returns a borrow of the field _4 + pub fn _4(&self) -> &T4 { + match self { + Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _4, + } + } + /// Returns a borrow of the field _5 + pub fn _5(&self) -> &T5 { + match self { + Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _5, + } + } + /// Returns a borrow of the field _6 + pub fn _6(&self) -> &T6 { + match self { + Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _6, + } + } + /// Returns a borrow of the field _7 + pub fn _7(&self) -> &T7 { + match self { + Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _7, + } + } + /// Returns a borrow of the field _8 + pub fn _8(&self) -> &T8 { + match self { + Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _8, + } + } + /// Returns a borrow of the field _9 + pub fn _9(&self) -> &T9 { + match self { + Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _9, + } + } + /// Returns a borrow of the field _10 + pub fn _10(&self) -> &T10 { + match self { + Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _10, + } + } + /// Returns a borrow of the field _11 + pub fn _11(&self) -> &T11 { + match self { + Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _11, + } + } + /// Returns a borrow of the field _12 + pub fn _12(&self) -> &T12 { + match self { + Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _12, + } + } + /// Returns a borrow of the field _13 + pub fn _13(&self) -> &T13 { + match self { + Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _13, + } + } + /// Returns a borrow of the field _14 + pub fn _14(&self) -> &T14 { + match self { + Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _14, + } + } + /// Returns a borrow of the field _15 + pub fn _15(&self) -> &T15 { + match self { + Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => _15, + } + } + } + + impl Debug + for Tuple16 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple16 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_1, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_2, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_3, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_4, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_5, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_6, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_7, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_8, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_9, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_10, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_11, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_12, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_13, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_14, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_15, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple16 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType, __T1: DafnyType, __T2: DafnyType, __T3: DafnyType, __T4: DafnyType, __T5: DafnyType, __T6: DafnyType, __T7: DafnyType, __T8: DafnyType, __T9: DafnyType, __T10: DafnyType, __T11: DafnyType, __T12: DafnyType, __T13: DafnyType, __T14: DafnyType, __T15: DafnyType>(f_0: Rc __T0 + 'static>, f_1: Rc __T1 + 'static>, f_2: Rc __T2 + 'static>, f_3: Rc __T3 + 'static>, f_4: Rc __T4 + 'static>, f_5: Rc __T5 + 'static>, f_6: Rc __T6 + 'static>, f_7: Rc __T7 + 'static>, f_8: Rc __T8 + 'static>, f_9: Rc __T9 + 'static>, f_10: Rc __T10 + 'static>, f_11: Rc __T11 + 'static>, f_12: Rc __T12 + 'static>, f_13: Rc __T13 + 'static>, f_14: Rc __T14 + 'static>, f_15: Rc __T15 + 'static>) -> Rc) -> Tuple16<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10, __T11, __T12, __T13, __T14, __T15>> { + Rc::new(move |this: Self| -> Tuple16<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10, __T11, __T12, __T13, __T14, __T15>{ + match this { + Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => { + Tuple16::_T16 { + _0: f_0.clone()(_0), + _1: f_1.clone()(_1), + _2: f_2.clone()(_2), + _3: f_3.clone()(_3), + _4: f_4.clone()(_4), + _5: f_5.clone()(_5), + _6: f_6.clone()(_6), + _7: f_7.clone()(_7), + _8: f_8.clone()(_8), + _9: f_9.clone()(_9), + _10: f_10.clone()(_10), + _11: f_11.clone()(_11), + _12: f_12.clone()(_12), + _13: f_13.clone()(_13), + _14: f_14.clone()(_14), + _15: f_15.clone()(_15) + } + }, + } + }) + } + } + + impl Eq + for Tuple16 {} + + impl Hash + for Tuple16 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple16::_T16{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, } => { + Hash::hash(_0, _state); + Hash::hash(_1, _state); + Hash::hash(_2, _state); + Hash::hash(_3, _state); + Hash::hash(_4, _state); + Hash::hash(_5, _state); + Hash::hash(_6, _state); + Hash::hash(_7, _state); + Hash::hash(_8, _state); + Hash::hash(_9, _state); + Hash::hash(_10, _state); + Hash::hash(_11, _state); + Hash::hash(_12, _state); + Hash::hash(_13, _state); + Hash::hash(_14, _state); + Hash::hash(_15, _state) + }, + } + } + } + + impl Default + for Tuple16 { + fn default() -> Tuple16 { + Tuple16::_T16 { + _0: Default::default(), + _1: Default::default(), + _2: Default::default(), + _3: Default::default(), + _4: Default::default(), + _5: Default::default(), + _6: Default::default(), + _7: Default::default(), + _8: Default::default(), + _9: Default::default(), + _10: Default::default(), + _11: Default::default(), + _12: Default::default(), + _13: Default::default(), + _14: Default::default(), + _15: Default::default() + } + } + } + + impl AsRef> + for Tuple16 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple17 { + _T17 { + _0: T0, + _1: T1, + _2: T2, + _3: T3, + _4: T4, + _5: T5, + _6: T6, + _7: T7, + _8: T8, + _9: T9, + _10: T10, + _11: T11, + _12: T12, + _13: T13, + _14: T14, + _15: T15, + _16: T16 + } + } + + impl Tuple17 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _0, + } + } + /// Returns a borrow of the field _1 + pub fn _1(&self) -> &T1 { + match self { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _1, + } + } + /// Returns a borrow of the field _2 + pub fn _2(&self) -> &T2 { + match self { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _2, + } + } + /// Returns a borrow of the field _3 + pub fn _3(&self) -> &T3 { + match self { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _3, + } + } + /// Returns a borrow of the field _4 + pub fn _4(&self) -> &T4 { + match self { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _4, + } + } + /// Returns a borrow of the field _5 + pub fn _5(&self) -> &T5 { + match self { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _5, + } + } + /// Returns a borrow of the field _6 + pub fn _6(&self) -> &T6 { + match self { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _6, + } + } + /// Returns a borrow of the field _7 + pub fn _7(&self) -> &T7 { + match self { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _7, + } + } + /// Returns a borrow of the field _8 + pub fn _8(&self) -> &T8 { + match self { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _8, + } + } + /// Returns a borrow of the field _9 + pub fn _9(&self) -> &T9 { + match self { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _9, + } + } + /// Returns a borrow of the field _10 + pub fn _10(&self) -> &T10 { + match self { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _10, + } + } + /// Returns a borrow of the field _11 + pub fn _11(&self) -> &T11 { + match self { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _11, + } + } + /// Returns a borrow of the field _12 + pub fn _12(&self) -> &T12 { + match self { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _12, + } + } + /// Returns a borrow of the field _13 + pub fn _13(&self) -> &T13 { + match self { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _13, + } + } + /// Returns a borrow of the field _14 + pub fn _14(&self) -> &T14 { + match self { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _14, + } + } + /// Returns a borrow of the field _15 + pub fn _15(&self) -> &T15 { + match self { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _15, + } + } + /// Returns a borrow of the field _16 + pub fn _16(&self) -> &T16 { + match self { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => _16, + } + } + } + + impl Debug + for Tuple17 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple17 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_1, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_2, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_3, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_4, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_5, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_6, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_7, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_8, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_9, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_10, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_11, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_12, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_13, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_14, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_15, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_16, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple17 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType, __T1: DafnyType, __T2: DafnyType, __T3: DafnyType, __T4: DafnyType, __T5: DafnyType, __T6: DafnyType, __T7: DafnyType, __T8: DafnyType, __T9: DafnyType, __T10: DafnyType, __T11: DafnyType, __T12: DafnyType, __T13: DafnyType, __T14: DafnyType, __T15: DafnyType, __T16: DafnyType>(f_0: Rc __T0 + 'static>, f_1: Rc __T1 + 'static>, f_2: Rc __T2 + 'static>, f_3: Rc __T3 + 'static>, f_4: Rc __T4 + 'static>, f_5: Rc __T5 + 'static>, f_6: Rc __T6 + 'static>, f_7: Rc __T7 + 'static>, f_8: Rc __T8 + 'static>, f_9: Rc __T9 + 'static>, f_10: Rc __T10 + 'static>, f_11: Rc __T11 + 'static>, f_12: Rc __T12 + 'static>, f_13: Rc __T13 + 'static>, f_14: Rc __T14 + 'static>, f_15: Rc __T15 + 'static>, f_16: Rc __T16 + 'static>) -> Rc) -> Tuple17<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10, __T11, __T12, __T13, __T14, __T15, __T16>> { + Rc::new(move |this: Self| -> Tuple17<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10, __T11, __T12, __T13, __T14, __T15, __T16>{ + match this { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => { + Tuple17::_T17 { + _0: f_0.clone()(_0), + _1: f_1.clone()(_1), + _2: f_2.clone()(_2), + _3: f_3.clone()(_3), + _4: f_4.clone()(_4), + _5: f_5.clone()(_5), + _6: f_6.clone()(_6), + _7: f_7.clone()(_7), + _8: f_8.clone()(_8), + _9: f_9.clone()(_9), + _10: f_10.clone()(_10), + _11: f_11.clone()(_11), + _12: f_12.clone()(_12), + _13: f_13.clone()(_13), + _14: f_14.clone()(_14), + _15: f_15.clone()(_15), + _16: f_16.clone()(_16) + } + }, + } + }) + } + } + + impl Eq + for Tuple17 {} + + impl Hash + for Tuple17 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple17::_T17{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, } => { + Hash::hash(_0, _state); + Hash::hash(_1, _state); + Hash::hash(_2, _state); + Hash::hash(_3, _state); + Hash::hash(_4, _state); + Hash::hash(_5, _state); + Hash::hash(_6, _state); + Hash::hash(_7, _state); + Hash::hash(_8, _state); + Hash::hash(_9, _state); + Hash::hash(_10, _state); + Hash::hash(_11, _state); + Hash::hash(_12, _state); + Hash::hash(_13, _state); + Hash::hash(_14, _state); + Hash::hash(_15, _state); + Hash::hash(_16, _state) + }, + } + } + } + + impl Default + for Tuple17 { + fn default() -> Tuple17 { + Tuple17::_T17 { + _0: Default::default(), + _1: Default::default(), + _2: Default::default(), + _3: Default::default(), + _4: Default::default(), + _5: Default::default(), + _6: Default::default(), + _7: Default::default(), + _8: Default::default(), + _9: Default::default(), + _10: Default::default(), + _11: Default::default(), + _12: Default::default(), + _13: Default::default(), + _14: Default::default(), + _15: Default::default(), + _16: Default::default() + } + } + } + + impl AsRef> + for Tuple17 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple18 { + _T18 { + _0: T0, + _1: T1, + _2: T2, + _3: T3, + _4: T4, + _5: T5, + _6: T6, + _7: T7, + _8: T8, + _9: T9, + _10: T10, + _11: T11, + _12: T12, + _13: T13, + _14: T14, + _15: T15, + _16: T16, + _17: T17 + } + } + + impl Tuple18 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _0, + } + } + /// Returns a borrow of the field _1 + pub fn _1(&self) -> &T1 { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _1, + } + } + /// Returns a borrow of the field _2 + pub fn _2(&self) -> &T2 { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _2, + } + } + /// Returns a borrow of the field _3 + pub fn _3(&self) -> &T3 { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _3, + } + } + /// Returns a borrow of the field _4 + pub fn _4(&self) -> &T4 { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _4, + } + } + /// Returns a borrow of the field _5 + pub fn _5(&self) -> &T5 { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _5, + } + } + /// Returns a borrow of the field _6 + pub fn _6(&self) -> &T6 { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _6, + } + } + /// Returns a borrow of the field _7 + pub fn _7(&self) -> &T7 { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _7, + } + } + /// Returns a borrow of the field _8 + pub fn _8(&self) -> &T8 { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _8, + } + } + /// Returns a borrow of the field _9 + pub fn _9(&self) -> &T9 { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _9, + } + } + /// Returns a borrow of the field _10 + pub fn _10(&self) -> &T10 { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _10, + } + } + /// Returns a borrow of the field _11 + pub fn _11(&self) -> &T11 { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _11, + } + } + /// Returns a borrow of the field _12 + pub fn _12(&self) -> &T12 { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _12, + } + } + /// Returns a borrow of the field _13 + pub fn _13(&self) -> &T13 { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _13, + } + } + /// Returns a borrow of the field _14 + pub fn _14(&self) -> &T14 { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _14, + } + } + /// Returns a borrow of the field _15 + pub fn _15(&self) -> &T15 { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _15, + } + } + /// Returns a borrow of the field _16 + pub fn _16(&self) -> &T16 { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _16, + } + } + /// Returns a borrow of the field _17 + pub fn _17(&self) -> &T17 { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => _17, + } + } + } + + impl Debug + for Tuple18 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple18 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_1, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_2, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_3, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_4, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_5, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_6, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_7, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_8, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_9, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_10, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_11, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_12, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_13, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_14, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_15, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_16, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_17, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple18 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType, __T1: DafnyType, __T2: DafnyType, __T3: DafnyType, __T4: DafnyType, __T5: DafnyType, __T6: DafnyType, __T7: DafnyType, __T8: DafnyType, __T9: DafnyType, __T10: DafnyType, __T11: DafnyType, __T12: DafnyType, __T13: DafnyType, __T14: DafnyType, __T15: DafnyType, __T16: DafnyType, __T17: DafnyType>(f_0: Rc __T0 + 'static>, f_1: Rc __T1 + 'static>, f_2: Rc __T2 + 'static>, f_3: Rc __T3 + 'static>, f_4: Rc __T4 + 'static>, f_5: Rc __T5 + 'static>, f_6: Rc __T6 + 'static>, f_7: Rc __T7 + 'static>, f_8: Rc __T8 + 'static>, f_9: Rc __T9 + 'static>, f_10: Rc __T10 + 'static>, f_11: Rc __T11 + 'static>, f_12: Rc __T12 + 'static>, f_13: Rc __T13 + 'static>, f_14: Rc __T14 + 'static>, f_15: Rc __T15 + 'static>, f_16: Rc __T16 + 'static>, f_17: Rc __T17 + 'static>) -> Rc) -> Tuple18<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10, __T11, __T12, __T13, __T14, __T15, __T16, __T17>> { + Rc::new(move |this: Self| -> Tuple18<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10, __T11, __T12, __T13, __T14, __T15, __T16, __T17>{ + match this { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => { + Tuple18::_T18 { + _0: f_0.clone()(_0), + _1: f_1.clone()(_1), + _2: f_2.clone()(_2), + _3: f_3.clone()(_3), + _4: f_4.clone()(_4), + _5: f_5.clone()(_5), + _6: f_6.clone()(_6), + _7: f_7.clone()(_7), + _8: f_8.clone()(_8), + _9: f_9.clone()(_9), + _10: f_10.clone()(_10), + _11: f_11.clone()(_11), + _12: f_12.clone()(_12), + _13: f_13.clone()(_13), + _14: f_14.clone()(_14), + _15: f_15.clone()(_15), + _16: f_16.clone()(_16), + _17: f_17.clone()(_17) + } + }, + } + }) + } + } + + impl Eq + for Tuple18 {} + + impl Hash + for Tuple18 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple18::_T18{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, } => { + Hash::hash(_0, _state); + Hash::hash(_1, _state); + Hash::hash(_2, _state); + Hash::hash(_3, _state); + Hash::hash(_4, _state); + Hash::hash(_5, _state); + Hash::hash(_6, _state); + Hash::hash(_7, _state); + Hash::hash(_8, _state); + Hash::hash(_9, _state); + Hash::hash(_10, _state); + Hash::hash(_11, _state); + Hash::hash(_12, _state); + Hash::hash(_13, _state); + Hash::hash(_14, _state); + Hash::hash(_15, _state); + Hash::hash(_16, _state); + Hash::hash(_17, _state) + }, + } + } + } + + impl Default + for Tuple18 { + fn default() -> Tuple18 { + Tuple18::_T18 { + _0: Default::default(), + _1: Default::default(), + _2: Default::default(), + _3: Default::default(), + _4: Default::default(), + _5: Default::default(), + _6: Default::default(), + _7: Default::default(), + _8: Default::default(), + _9: Default::default(), + _10: Default::default(), + _11: Default::default(), + _12: Default::default(), + _13: Default::default(), + _14: Default::default(), + _15: Default::default(), + _16: Default::default(), + _17: Default::default() + } + } + } + + impl AsRef> + for Tuple18 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple19 { + _T19 { + _0: T0, + _1: T1, + _2: T2, + _3: T3, + _4: T4, + _5: T5, + _6: T6, + _7: T7, + _8: T8, + _9: T9, + _10: T10, + _11: T11, + _12: T12, + _13: T13, + _14: T14, + _15: T15, + _16: T16, + _17: T17, + _18: T18 + } + } + + impl Tuple19 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _0, + } + } + /// Returns a borrow of the field _1 + pub fn _1(&self) -> &T1 { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _1, + } + } + /// Returns a borrow of the field _2 + pub fn _2(&self) -> &T2 { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _2, + } + } + /// Returns a borrow of the field _3 + pub fn _3(&self) -> &T3 { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _3, + } + } + /// Returns a borrow of the field _4 + pub fn _4(&self) -> &T4 { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _4, + } + } + /// Returns a borrow of the field _5 + pub fn _5(&self) -> &T5 { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _5, + } + } + /// Returns a borrow of the field _6 + pub fn _6(&self) -> &T6 { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _6, + } + } + /// Returns a borrow of the field _7 + pub fn _7(&self) -> &T7 { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _7, + } + } + /// Returns a borrow of the field _8 + pub fn _8(&self) -> &T8 { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _8, + } + } + /// Returns a borrow of the field _9 + pub fn _9(&self) -> &T9 { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _9, + } + } + /// Returns a borrow of the field _10 + pub fn _10(&self) -> &T10 { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _10, + } + } + /// Returns a borrow of the field _11 + pub fn _11(&self) -> &T11 { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _11, + } + } + /// Returns a borrow of the field _12 + pub fn _12(&self) -> &T12 { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _12, + } + } + /// Returns a borrow of the field _13 + pub fn _13(&self) -> &T13 { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _13, + } + } + /// Returns a borrow of the field _14 + pub fn _14(&self) -> &T14 { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _14, + } + } + /// Returns a borrow of the field _15 + pub fn _15(&self) -> &T15 { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _15, + } + } + /// Returns a borrow of the field _16 + pub fn _16(&self) -> &T16 { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _16, + } + } + /// Returns a borrow of the field _17 + pub fn _17(&self) -> &T17 { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _17, + } + } + /// Returns a borrow of the field _18 + pub fn _18(&self) -> &T18 { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => _18, + } + } + } + + impl Debug + for Tuple19 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple19 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_1, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_2, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_3, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_4, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_5, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_6, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_7, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_8, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_9, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_10, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_11, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_12, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_13, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_14, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_15, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_16, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_17, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_18, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple19 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType, __T1: DafnyType, __T2: DafnyType, __T3: DafnyType, __T4: DafnyType, __T5: DafnyType, __T6: DafnyType, __T7: DafnyType, __T8: DafnyType, __T9: DafnyType, __T10: DafnyType, __T11: DafnyType, __T12: DafnyType, __T13: DafnyType, __T14: DafnyType, __T15: DafnyType, __T16: DafnyType, __T17: DafnyType, __T18: DafnyType>(f_0: Rc __T0 + 'static>, f_1: Rc __T1 + 'static>, f_2: Rc __T2 + 'static>, f_3: Rc __T3 + 'static>, f_4: Rc __T4 + 'static>, f_5: Rc __T5 + 'static>, f_6: Rc __T6 + 'static>, f_7: Rc __T7 + 'static>, f_8: Rc __T8 + 'static>, f_9: Rc __T9 + 'static>, f_10: Rc __T10 + 'static>, f_11: Rc __T11 + 'static>, f_12: Rc __T12 + 'static>, f_13: Rc __T13 + 'static>, f_14: Rc __T14 + 'static>, f_15: Rc __T15 + 'static>, f_16: Rc __T16 + 'static>, f_17: Rc __T17 + 'static>, f_18: Rc __T18 + 'static>) -> Rc) -> Tuple19<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10, __T11, __T12, __T13, __T14, __T15, __T16, __T17, __T18>> { + Rc::new(move |this: Self| -> Tuple19<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10, __T11, __T12, __T13, __T14, __T15, __T16, __T17, __T18>{ + match this { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => { + Tuple19::_T19 { + _0: f_0.clone()(_0), + _1: f_1.clone()(_1), + _2: f_2.clone()(_2), + _3: f_3.clone()(_3), + _4: f_4.clone()(_4), + _5: f_5.clone()(_5), + _6: f_6.clone()(_6), + _7: f_7.clone()(_7), + _8: f_8.clone()(_8), + _9: f_9.clone()(_9), + _10: f_10.clone()(_10), + _11: f_11.clone()(_11), + _12: f_12.clone()(_12), + _13: f_13.clone()(_13), + _14: f_14.clone()(_14), + _15: f_15.clone()(_15), + _16: f_16.clone()(_16), + _17: f_17.clone()(_17), + _18: f_18.clone()(_18) + } + }, + } + }) + } + } + + impl Eq + for Tuple19 {} + + impl Hash + for Tuple19 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple19::_T19{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, } => { + Hash::hash(_0, _state); + Hash::hash(_1, _state); + Hash::hash(_2, _state); + Hash::hash(_3, _state); + Hash::hash(_4, _state); + Hash::hash(_5, _state); + Hash::hash(_6, _state); + Hash::hash(_7, _state); + Hash::hash(_8, _state); + Hash::hash(_9, _state); + Hash::hash(_10, _state); + Hash::hash(_11, _state); + Hash::hash(_12, _state); + Hash::hash(_13, _state); + Hash::hash(_14, _state); + Hash::hash(_15, _state); + Hash::hash(_16, _state); + Hash::hash(_17, _state); + Hash::hash(_18, _state) + }, + } + } + } + + impl Default + for Tuple19 { + fn default() -> Tuple19 { + Tuple19::_T19 { + _0: Default::default(), + _1: Default::default(), + _2: Default::default(), + _3: Default::default(), + _4: Default::default(), + _5: Default::default(), + _6: Default::default(), + _7: Default::default(), + _8: Default::default(), + _9: Default::default(), + _10: Default::default(), + _11: Default::default(), + _12: Default::default(), + _13: Default::default(), + _14: Default::default(), + _15: Default::default(), + _16: Default::default(), + _17: Default::default(), + _18: Default::default() + } + } + } + + impl AsRef> + for Tuple19 { + fn as_ref(&self) -> &Self { + self + } + } + + #[derive(PartialEq, Clone)] + pub enum Tuple20 { + _T20 { + _0: T0, + _1: T1, + _2: T2, + _3: T3, + _4: T4, + _5: T5, + _6: T6, + _7: T7, + _8: T8, + _9: T9, + _10: T10, + _11: T11, + _12: T12, + _13: T13, + _14: T14, + _15: T15, + _16: T16, + _17: T17, + _18: T18, + _19: T19 + } + } + + impl Tuple20 { + /// Returns a borrow of the field _0 + pub fn _0(&self) -> &T0 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _0, + } + } + /// Returns a borrow of the field _1 + pub fn _1(&self) -> &T1 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _1, + } + } + /// Returns a borrow of the field _2 + pub fn _2(&self) -> &T2 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _2, + } + } + /// Returns a borrow of the field _3 + pub fn _3(&self) -> &T3 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _3, + } + } + /// Returns a borrow of the field _4 + pub fn _4(&self) -> &T4 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _4, + } + } + /// Returns a borrow of the field _5 + pub fn _5(&self) -> &T5 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _5, + } + } + /// Returns a borrow of the field _6 + pub fn _6(&self) -> &T6 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _6, + } + } + /// Returns a borrow of the field _7 + pub fn _7(&self) -> &T7 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _7, + } + } + /// Returns a borrow of the field _8 + pub fn _8(&self) -> &T8 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _8, + } + } + /// Returns a borrow of the field _9 + pub fn _9(&self) -> &T9 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _9, + } + } + /// Returns a borrow of the field _10 + pub fn _10(&self) -> &T10 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _10, + } + } + /// Returns a borrow of the field _11 + pub fn _11(&self) -> &T11 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _11, + } + } + /// Returns a borrow of the field _12 + pub fn _12(&self) -> &T12 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _12, + } + } + /// Returns a borrow of the field _13 + pub fn _13(&self) -> &T13 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _13, + } + } + /// Returns a borrow of the field _14 + pub fn _14(&self) -> &T14 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _14, + } + } + /// Returns a borrow of the field _15 + pub fn _15(&self) -> &T15 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _15, + } + } + /// Returns a borrow of the field _16 + pub fn _16(&self) -> &T16 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _16, + } + } + /// Returns a borrow of the field _17 + pub fn _17(&self) -> &T17 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _17, + } + } + /// Returns a borrow of the field _18 + pub fn _18(&self) -> &T18 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _18, + } + } + /// Returns a borrow of the field _19 + pub fn _19(&self) -> &T19 { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => _19, + } + } + } + + impl Debug + for Tuple20 { + fn fmt(&self, f: &mut Formatter) -> Result { + DafnyPrint::fmt_print(self, f, true) + } + } + + impl DafnyPrint + for Tuple20 { + fn fmt_print(&self, _formatter: &mut Formatter, _in_seq: bool) -> std::fmt::Result { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => { + write!(_formatter, "(")?; + DafnyPrint::fmt_print(_0, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_1, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_2, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_3, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_4, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_5, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_6, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_7, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_8, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_9, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_10, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_11, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_12, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_13, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_14, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_15, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_16, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_17, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_18, _formatter, false)?; + write!(_formatter, ", ")?; + DafnyPrint::fmt_print(_19, _formatter, false)?; + write!(_formatter, ")")?; + Ok(()) + }, + } + } + } + + impl Tuple20 { + /// Given type parameter conversions, returns a lambda to convert this structure + pub fn coerce<__T0: DafnyType, __T1: DafnyType, __T2: DafnyType, __T3: DafnyType, __T4: DafnyType, __T5: DafnyType, __T6: DafnyType, __T7: DafnyType, __T8: DafnyType, __T9: DafnyType, __T10: DafnyType, __T11: DafnyType, __T12: DafnyType, __T13: DafnyType, __T14: DafnyType, __T15: DafnyType, __T16: DafnyType, __T17: DafnyType, __T18: DafnyType, __T19: DafnyType>(f_0: Rc __T0 + 'static>, f_1: Rc __T1 + 'static>, f_2: Rc __T2 + 'static>, f_3: Rc __T3 + 'static>, f_4: Rc __T4 + 'static>, f_5: Rc __T5 + 'static>, f_6: Rc __T6 + 'static>, f_7: Rc __T7 + 'static>, f_8: Rc __T8 + 'static>, f_9: Rc __T9 + 'static>, f_10: Rc __T10 + 'static>, f_11: Rc __T11 + 'static>, f_12: Rc __T12 + 'static>, f_13: Rc __T13 + 'static>, f_14: Rc __T14 + 'static>, f_15: Rc __T15 + 'static>, f_16: Rc __T16 + 'static>, f_17: Rc __T17 + 'static>, f_18: Rc __T18 + 'static>, f_19: Rc __T19 + 'static>) -> Rc) -> Tuple20<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10, __T11, __T12, __T13, __T14, __T15, __T16, __T17, __T18, __T19>> { + Rc::new(move |this: Self| -> Tuple20<__T0, __T1, __T2, __T3, __T4, __T5, __T6, __T7, __T8, __T9, __T10, __T11, __T12, __T13, __T14, __T15, __T16, __T17, __T18, __T19>{ + match this { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => { + Tuple20::_T20 { + _0: f_0.clone()(_0), + _1: f_1.clone()(_1), + _2: f_2.clone()(_2), + _3: f_3.clone()(_3), + _4: f_4.clone()(_4), + _5: f_5.clone()(_5), + _6: f_6.clone()(_6), + _7: f_7.clone()(_7), + _8: f_8.clone()(_8), + _9: f_9.clone()(_9), + _10: f_10.clone()(_10), + _11: f_11.clone()(_11), + _12: f_12.clone()(_12), + _13: f_13.clone()(_13), + _14: f_14.clone()(_14), + _15: f_15.clone()(_15), + _16: f_16.clone()(_16), + _17: f_17.clone()(_17), + _18: f_18.clone()(_18), + _19: f_19.clone()(_19) + } + }, + } + }) + } + } + + impl Eq + for Tuple20 {} + + impl Hash + for Tuple20 { + fn hash<_H: Hasher>(&self, _state: &mut _H) { + match self { + Tuple20::_T20{_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, } => { + Hash::hash(_0, _state); + Hash::hash(_1, _state); + Hash::hash(_2, _state); + Hash::hash(_3, _state); + Hash::hash(_4, _state); + Hash::hash(_5, _state); + Hash::hash(_6, _state); + Hash::hash(_7, _state); + Hash::hash(_8, _state); + Hash::hash(_9, _state); + Hash::hash(_10, _state); + Hash::hash(_11, _state); + Hash::hash(_12, _state); + Hash::hash(_13, _state); + Hash::hash(_14, _state); + Hash::hash(_15, _state); + Hash::hash(_16, _state); + Hash::hash(_17, _state); + Hash::hash(_18, _state); + Hash::hash(_19, _state) + }, + } + } + } + + impl Default + for Tuple20 { + fn default() -> Tuple20 { + Tuple20::_T20 { + _0: Default::default(), + _1: Default::default(), + _2: Default::default(), + _3: Default::default(), + _4: Default::default(), + _5: Default::default(), + _6: Default::default(), + _7: Default::default(), + _8: Default::default(), + _9: Default::default(), + _10: Default::default(), + _11: Default::default(), + _12: Default::default(), + _13: Default::default(), + _14: Default::default(), + _15: Default::default(), + _16: Default::default(), + _17: Default::default(), + _18: Default::default(), + _19: Default::default() + } + } + } + + impl AsRef> + for Tuple20 { + fn as_ref(&self) -> &Self { + self + } + } } \ No newline at end of file diff --git a/releases/rust/db_esdk/dafny_runtime_rust/src/tests/mod.rs b/releases/rust/db_esdk/dafny_runtime_rust/src/tests/mod.rs index 6f04042bd..4ac2fb26b 100644 --- a/releases/rust/db_esdk/dafny_runtime_rust/src/tests/mod.rs +++ b/releases/rust/db_esdk/dafny_runtime_rust/src/tests/mod.rs @@ -20,6 +20,57 @@ mod tests { assert_eq!(x.to_i128().unwrap(), truncate!(x.clone(), i128)); } + #[cfg(feature = "sync")] + #[test] + fn test_sequence_sync() { + // We are going to create 2 sequences of length 5, a and b. + // From these two, we create 2 new sequences a + b and b + a + // Two threads will transform the first a + b to a vec while two more threads will transform the second one to a vec + // At the end, everything should work fine, the sequences of each pair of thread should be equal + // and there should have been no run-time issue. + // We are going to repeat this 100 times + let a: Sequence = seq![0, 1, 2, 3, 4]; + let b: Sequence = seq![5, 6, 7, 8, 9]; + for _ in 0..100 { + let a_copy_1 = a.clone(); + let b_copy_1 = b.clone(); + let a_copy_2 = a.clone(); + let b_copy_2 = b.clone(); + let a_copy_3 = a.clone(); + let b_copy_3 = b.clone(); + let a_copy_4 = a.clone(); + let b_copy_4 = b.clone(); + let handle_ab = std::thread::spawn(move || { + let a_plus_b = a_copy_1.concat(&b_copy_1); + let a_plus_b_vec = a_plus_b.to_array(); + a_plus_b_vec + }); + let handle_ba = std::thread::spawn(move || { + let b_plus_a = b_copy_2.concat(&a_copy_2); + let b_plus_a_vec = b_plus_a.to_array(); + b_plus_a_vec + }); + let handle_ab_2 = std::thread::spawn(move || { + let a_plus_b = a_copy_3.concat(&b_copy_3); + let a_plus_b_vec = a_plus_b.to_array(); + a_plus_b_vec + }); + let handle_ba_2 = std::thread::spawn(move || { + let b_plus_a = b_copy_4.concat(&a_copy_4); + let b_plus_a_vec = b_plus_a.to_array(); + b_plus_a_vec + }); + // Now let's join on all these threads + let a_plus_b_vec = handle_ab.join().unwrap(); + let b_plus_a_vec = handle_ba.join().unwrap(); + let a_plus_b_vec_2 = handle_ab_2.join().unwrap(); + let b_plus_a_vec_2 = handle_ba_2.join().unwrap(); + // Let's test equalities + assert_eq!(a_plus_b_vec, a_plus_b_vec_2); + assert_eq!(b_plus_a_vec, b_plus_a_vec_2); + } + } + #[test] fn test_sequence() { let values = vec![1, 2, 3]; @@ -36,26 +87,38 @@ mod tests { assert_eq!(concat.cardinality_usize(), 6); match &concat { Sequence::ConcatSequence { - boxed, + cache: boxed, length, left, .. } => { assert_eq!(*length, 6); - assert_eq!(unsafe { &*left.get() }.cardinality_usize(), 3); + #[cfg(not(feature = "sync"))] + assert_eq!(left.as_ref().borrow().cardinality_usize(), 3); + #[cfg(feature = "sync")] + assert_eq!(left.as_ref().lock().unwrap().cardinality_usize(), 3); // Test that boxed is None + #[cfg(not(feature = "sync"))] assert!(boxed.as_ref().clone().borrow().as_ref().is_none()); + #[cfg(feature = "sync")] + assert!(boxed.as_ref().lock().unwrap().as_ref().is_none()); } _ => panic!("This should never happen"), } let value = concat.get_usize(0); assert_eq!(value, 1); match &concat { - crate::Sequence::ConcatSequence { boxed, .. } => { + crate::Sequence::ConcatSequence { cache: boxed, .. } => { + #[cfg(not(feature = "sync"))] assert_eq!( *boxed.as_ref().clone().borrow().as_ref().unwrap().as_ref(), vec![1, 2, 3, 4, 5, 6] ); + #[cfg(feature = "sync")] + assert_eq!( + *boxed.as_ref().lock().unwrap().as_ref().unwrap().as_ref(), + vec![1, 2, 3, 4, 5, 6] + ); } _ => panic!("This should never happen"), } @@ -308,7 +371,6 @@ mod tests { array::update_usize(v2, 1, 10); assert_eq!(array::get_usize(v2, 1), 10); - let v3 = array::initialize(&int!(3), Rc::new(|i| i.clone() + int!(1))); assert_eq!(array::length_usize(v3), 3); assert_eq!(array::get_usize(v3, 0), int!(1)); @@ -335,10 +397,14 @@ mod tests { assert_eq!(read!(p).length1_usize(), 4); let v = read!(p).to_vec(); assert_eq!(v.len(), 3); - assert_eq!(v, vec![ - vec![int!(0), int!(1), int!(2), int!(3)], - vec![int!(1), int!(2), int!(3), int!(4)], - vec![int!(2), int!(3), int!(4), int!(5)]]); + assert_eq!( + v, + vec![ + vec![int!(0), int!(1), int!(2), int!(3)], + vec![int!(1), int!(2), int!(3), int!(4)], + vec![int!(2), int!(3), int!(4), int!(5)] + ] + ); deallocate(p); // Allocate an array whose first dimension is zero @@ -409,7 +475,7 @@ mod tests { update_field_mut_uninit!(this, x, x_assigned, int!(2)); update_field_mut_uninit!(this, x, x_assigned, int!(1)); // If we can prove that x is assigned, we can even write this - modify_field!(read!(this).x,int!(0)); + modify_field!(read!(this).x, int!(0)); update_field_nodrop!(this, constant, int!(42)); update_field_mut_if_uninit!(this, x, x_assigned, int!(0)); assert_eq!(x_assigned, true); @@ -429,22 +495,27 @@ mod tests { update_field_mut_uninit_object!(this, x, x_assigned, int!(2)); update_field_mut_uninit_object!(this, x, x_assigned, int!(1)); // If we can prove that x is assigned, we can even write this - modify_field!(rd!(this).x,int!(0)); + modify_field!(rd!(this).x, int!(0)); update_field_nodrop_object!(this, constant, int!(42)); update_field_mut_if_uninit_object!(this, x, x_assigned, int!(0)); assert_eq!(x_assigned, true); let mut next_assigned = true; - update_field_if_uninit_object!(this, next, next_assigned, Ptr::from_raw_nonnull(this.as_mut())); + update_field_if_uninit_object!( + this, + next, + next_assigned, + Ptr::from_raw_nonnull(this.as_mut()) + ); assert_eq!(next_assigned, true); this } } - impl Upcast for ClassWrapper { - UpcastFn!(dyn Any); + impl Upcast for ClassWrapper { + UpcastFn!(crate::DynAny); } - impl UpcastObject for ClassWrapper { - UpcastObjectFn!(dyn Any); + impl UpcastObject for ClassWrapper { + UpcastObjectFn!(crate::DynAny); } #[test] @@ -458,9 +529,9 @@ mod tests { assert_eq!(read!(c).constant_plus_x(), int!(42)); modify!(c).increment_x(); assert_eq!(read!(c).constant_plus_x(), int!(43)); - modify_field!(read!(c).x,int!(40)); + modify_field!(read!(c).x, int!(40)); assert_eq!(read!(c).constant_plus_x(), int!(82)); - modify_field!(read!(c).t,54); + modify_field!(read!(c).t, 54); assert_eq!(read_field!(read!(c).t), 54); let x_copy = read_field!(read!(c).x); assert_eq!(Rc::strong_count(&x_copy.data), 2); @@ -468,7 +539,6 @@ mod tests { assert_eq!(Rc::strong_count(&x_copy.data), 1); } - #[test] #[allow(unused_unsafe)] fn test_class_wrapper_object() { @@ -481,10 +551,10 @@ mod tests { md!(c).increment_x(); assert_eq!(rd!(c).constant_plus_x(), int!(43)); if true { - modify_field!(rd!(c).x,int!(40)) + modify_field!(rd!(c).x, int!(40)) } assert_eq!(rd!(c).constant_plus_x(), int!(82)); - modify_field!(rd!(c).t,54); + modify_field!(rd!(c).t, 54); assert_eq!(read_field!(rd!(c).t), 54); } @@ -546,19 +616,30 @@ mod tests { #[test] fn test_coercion_immutable() { let o = ClassWrapper::::constructor(1); - let a: Ptr = Upcast::::upcast(read!(o)); + let a: Ptr = Upcast::::upcast(read!(o)); assert_eq!(cast!(a, ClassWrapper), o); let seq_o = seq![o]; - let seq_a = Sequence::>>::coerce(upcast::, dyn Any>())(seq_o); + let seq_a = Sequence::>>::coerce(upcast::< + ClassWrapper, + crate::DynAny, + >())(seq_o); assert_eq!(cast!(seq_a.get_usize(0), ClassWrapper), o); let set_o = set! {o}; - let set_a = Set::>>::coerce(upcast::, dyn Any>())(set_o); + let set_a = Set::>>::coerce( + upcast::, crate::DynAny>(), + )(set_o); assert_eq!(cast!(set_a.peek(), ClassWrapper), o); let multiset_o = multiset! {o, o}; - let multiset_a = Multiset::>>::coerce(upcast::, dyn Any>())(multiset_o); + let multiset_a = Multiset::>>::coerce(upcast::< + ClassWrapper, + crate::DynAny, + >())(multiset_o); assert_eq!(cast!(multiset_a.peek(), ClassWrapper), o); let map_o = map![1 => o, 2 => o]; - let map_a = Map::>>::coerce(upcast::, dyn Any>())(map_o); + let map_a = Map::>>::coerce(upcast::< + ClassWrapper, + crate::DynAny, + >())(map_o); assert_eq!(cast!(map_a.get(&1), ClassWrapper), o); deallocate(o); } @@ -591,6 +672,9 @@ mod tests { #[test] fn test_function_wrappers() { + #[cfg(feature = "sync")] + let f: Rc i32 + Send + Sync> = Rc::new(|i: i32| i + 1); + #[cfg(not(feature = "sync"))] let f: Rc i32> = Rc::new(|i: i32| i + 1); let g = f.clone(); let _h = seq![g]; @@ -683,12 +767,23 @@ mod tests { .any(Rc::new(|i: u32| i % 2 == 0).as_ref())); let count = Rc::new(RefCell::new(0)); let count_inner = count.clone(); - multiset!{1, 1, 5, 7, 8} - .iter().for_each(move |_i: u32| { + multiset! {1, 1, 5, 7, 8}.iter().for_each(move |_i: u32| { + #[cfg(not(feature = "sync"))] + { let c: i32 = *count_inner.as_ref().borrow(); *count_inner.borrow_mut() = c + 1; - }); + } + #[cfg(feature = "sync")] + { + let mut guard = count_inner.as_ref().lock().unwrap(); + let c: i32 = *guard; + *guard = c + 1; + } + }); + #[cfg(not(feature = "sync"))] assert_eq!(*count.as_ref().borrow(), 5); + #[cfg(feature = "sync")] + assert_eq!(*count.as_ref().lock().unwrap(), 5); let m = map![1 => 4, 3 => 6, 5 => 8]; let m2 = m.clone(); @@ -745,11 +840,9 @@ mod tests { assert_eq!(sum, 55); } - trait SuperTrait: Upcast + UpcastObject { - } + trait SuperTrait: Upcast + UpcastObject {} - trait NodeRcMutTrait: SuperTrait + Upcast + UpcastObject{ - } + trait NodeRcMutTrait: SuperTrait + Upcast + UpcastObject {} pub struct NodeRcMut { val: DafnyInt, @@ -764,11 +857,11 @@ mod tests { } } impl SuperTrait for NodeRcMut {} - impl UpcastObject for NodeRcMut { - UpcastObjectFn!(dyn Any); + impl UpcastObject for NodeRcMut { + UpcastObjectFn!(crate::DynAny); } - impl Upcast for NodeRcMut { - UpcastFn!(dyn Any); + impl Upcast for NodeRcMut { + UpcastFn!(crate::DynAny); } impl UpcastObject for NodeRcMut { UpcastObjectFn!(dyn NodeRcMutTrait); @@ -795,7 +888,7 @@ mod tests { assert_eq!(x.as_ref().next.as_ref().val, int!(42)); md!(rd!(x).next).next = Object(None); assert_eq!(refcount!(x), 1); - let y: Object = upcast_object::<_, _>()(x.clone()); + let y: Object = upcast_object::<_, _>()(x.clone()); assert_eq!(refcount!(x), 2); let z: Object = upcast_object::<_, _>()(x.clone()); assert_eq!(refcount!(x), 3); @@ -807,13 +900,16 @@ mod tests { assert_eq!(rd!(a3).val, int!(42)); // Other way to create objects - let direct: Object = Object::::new(NodeRcMut {val: int!(1), next: Object::::null()}); + let direct: Object = Object::::new(NodeRcMut { + val: int!(1), + next: Object::::null(), + }); assert_eq!(rd!(direct).val, int!(1)); let tail: Object = Object::::null(); assert_eq!(tail, rd!(direct).next); assert!(tail.is_null()); assert!(!direct.is_null()); - + let a: Object<[i32]> = rcmut::array_object_from_rc(Rc::new([42, 43, 44])); assert_eq!(rd!(a).len(), 3); assert_eq!(rd!(a)[0], 42); @@ -831,7 +927,8 @@ mod tests { } assert_eq!(refcount!(x), previous_count); - let objects: Set> = crate::set!{y.clone(), cast_any_object!(x.clone())}; + let objects: Set> = + crate::set! {y.clone(), cast_any_object!(x.clone())}; assert_eq!(objects.cardinality_usize(), 1); test_dafny_type(a.clone()); } @@ -847,8 +944,18 @@ mod tests { } } impl NodeRcMutTrait for NodeRawMut {} - UpcastDefObject!(NodeRawMut, dyn NodeRcMutTrait, dyn SuperTrait, dyn Any); - UpcastDef!(NodeRawMut, dyn NodeRcMutTrait, dyn SuperTrait, dyn Any); + UpcastDefObject!( + NodeRawMut, + dyn NodeRcMutTrait, + dyn SuperTrait, + crate::DynAny + ); + UpcastDef!( + NodeRawMut, + dyn NodeRcMutTrait, + dyn SuperTrait, + crate::DynAny + ); impl SuperTrait for NodeRawMut {} @@ -860,7 +967,7 @@ mod tests { modify!(x.clone()).next = x.clone(); assert_eq!(read!(read!(x.clone()).next.clone()).val, int!(42)); modify!(read!(x.clone()).next.clone()).next = Ptr::null(); - let y: Ptr = upcast::<_, _>()(x); + let y: Ptr = upcast::<_, _>()(x); assert!(y.is_instance_of::()); assert!(!y.is_instance_of::()); let z: Ptr = upcast::<_, _>()(x); @@ -893,24 +1000,24 @@ mod tests { } // Tests that we can compose Dafny types, like a sequence of maps - fn _test(_input: Sequence>) { - } + fn _test(_input: Sequence>) {} // Tests that the input type is a DafnyType - fn test_dafny_type(_input: X) { - } + fn test_dafny_type(_input: X) {} #[derive(Clone)] pub struct InternalOpaqueError { pub message: String, } - crate::UpcastDefObject!(InternalOpaqueError, dyn Any); + crate::UpcastDefObject!(InternalOpaqueError, crate::DynAny); #[test] fn test_native_string_upcast() { - let s = InternalOpaqueError { message: "Hello, World!".to_string() }; + let s = InternalOpaqueError { + message: "Hello, World!".to_string(), + }; let o: Object = Object::new(s); - let n: Object = upcast_object::()(o); + let n: Object = upcast_object::()(o); let x = cast_object!(n, InternalOpaqueError); let s2 = crate::dafny_runtime_conversions::object::dafny_class_to_struct(x); assert_eq!(s2.message, "Hello, World!"); @@ -920,7 +1027,8 @@ mod tests { fn test_native_string_upcast_raw() { let message = "Hello, World!".to_string(); let object = Object::new(message.clone()); - let object_any: Object = UpcastObject::::upcast(object.as_ref()); + let object_any: Object = + UpcastObject::::upcast(object.as_ref()); let resulting_message = format!("{:?}", object_any); assert_eq!(resulting_message, message); } @@ -933,12 +1041,12 @@ mod tests { fn _is_Datatype(&self) -> bool; fn _as_Datatype(&self) -> ADatatype; } - impl Clone for Box> { + impl Clone for Box> { fn clone(&self) -> Self { GeneralTraitSuper::_clone(self.as_ref()) } } - impl DafnyPrint for Box> { + impl DafnyPrint for Box> { fn fmt_print(&self, f: &mut Formatter<'_>, _in_seq: bool) -> std::fmt::Result { write!(f, "GeneralTraitSuper") } @@ -964,7 +1072,9 @@ mod tests { } #[derive(Clone, PartialEq, Debug)] - struct ADatatype{i: i32} + struct ADatatype { + i: i32, + } impl GeneralTrait for ADatatype { fn _clone(&self) -> Box { Box::new(self.clone()) as Box @@ -974,19 +1084,19 @@ mod tests { fn _clone(&self) -> Box> { Box::new(self.clone()) } - + fn _is_GeneralTrait(&self) -> bool { true } - + fn _as_GeneralTrait(&self) -> Box { GeneralTrait::_clone(self) } - + fn _is_Datatype(&self) -> bool { true } - + fn _as_Datatype(&self) -> ADatatype { self.clone() } @@ -1003,7 +1113,7 @@ mod tests { } #[test] fn test_general_traits() { - let x = ADatatype{i: 3}; + let x = ADatatype { i: 3 }; let gt = upcast_box::()(x.clone()); let gts = upcast_box::>()(x.clone()); let gtgts = upcast_box_box::>()(gt.clone()); @@ -1022,11 +1132,21 @@ mod tests { assert_eq!(gtsgt._as_Datatype(), x); assert_eq!(gtsgt._as_Datatype(), x); } + + #[test] + fn test_chars_copy() { + let c = DafnyChar('a'); + let c2 = c; + let c3 = c; + assert_eq!(c3, c2); + let c = DafnyCharUTF16(213); + let c2 = c; + let c3 = c; + assert_eq!(c3, c2); + } /*impl GeneralTrait for Rc { fn _clone(&self) -> Box { Box::new(self.as_ref().clone()) } }*/ - - } diff --git a/submodules/MaterialProviders b/submodules/MaterialProviders index 9c80544bb..5808fbfd1 160000 --- a/submodules/MaterialProviders +++ b/submodules/MaterialProviders @@ -1 +1 @@ -Subproject commit 9c80544bbfeac5547915aa93795f9b79eac7db6b +Subproject commit 5808fbfd13ed12eb258883010626e1ae75708089 diff --git a/submodules/smithy-dafny b/submodules/smithy-dafny index 84523f4cb..5fb3f25ea 160000 --- a/submodules/smithy-dafny +++ b/submodules/smithy-dafny @@ -1 +1 @@ -Subproject commit 84523f4cb6e76503c7f2cd4ac9e67adea709d013 +Subproject commit 5fb3f25ea3444c51b2ad30b25ab03964cf866cd1