From 429953d801cda505ccfb6d4fdafdc98f0fb3e089 Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Fri, 10 Jan 2025 10:35:47 -0500 Subject: [PATCH 01/30] chore: add example for when async is fixed --- DynamoDbEncryption/runtimes/rust/Cargo.toml | 3 +++ DynamoDbEncryption/runtimes/rust/examples/main.rs | 3 +++ DynamoDbEncryption/runtimes/rust/src/lib.rs | 3 --- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/DynamoDbEncryption/runtimes/rust/Cargo.toml b/DynamoDbEncryption/runtimes/rust/Cargo.toml index 9dcc9c7dc..1e1a134d2 100644 --- a/DynamoDbEncryption/runtimes/rust/Cargo.toml +++ b/DynamoDbEncryption/runtimes/rust/Cargo.toml @@ -33,3 +33,6 @@ uuid = { version = "1.11.0", features = ["v4"] } [[example]] name = "main" + +[features] +async-fixed = [] diff --git a/DynamoDbEncryption/runtimes/rust/examples/main.rs b/DynamoDbEncryption/runtimes/rust/examples/main.rs index f82979bcb..0825f1841 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/main.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/main.rs @@ -15,6 +15,9 @@ pub mod multi_get_put_example; pub mod searchableencryption; pub mod test_utils; +#[cfg(feature = "async-fixed")] +pub mod basic_async; + use std::convert::From; // Why two types? diff --git a/DynamoDbEncryption/runtimes/rust/src/lib.rs b/DynamoDbEncryption/runtimes/rust/src/lib.rs index 06c086eec..7c78888c1 100644 --- a/DynamoDbEncryption/runtimes/rust/src/lib.rs +++ b/DynamoDbEncryption/runtimes/rust/src/lib.rs @@ -86,9 +86,6 @@ 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; From e177ba86bc6bc029b225fcf25d9be6f821690f8e Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Fri, 10 Jan 2025 10:36:39 -0500 Subject: [PATCH 02/30] m --- .../runtimes/rust/examples/basic_async.rs | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 DynamoDbEncryption/runtimes/rust/examples/basic_async.rs diff --git a/DynamoDbEncryption/runtimes/rust/examples/basic_async.rs b/DynamoDbEncryption/runtimes/rust/examples/basic_async.rs new file mode 100644 index 000000000..f44aab333 --- /dev/null +++ b/DynamoDbEncryption/runtimes/rust/examples/basic_async.rs @@ -0,0 +1,48 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +use std::future::Future; +use aws_db_esdk::key_store::types::KeyStoreConfig; +use aws_db_esdk::key_store::types::KmsConfiguration; +use aws_db_esdk::material_providers::types::MaterialProvidersConfig; +use aws_db_esdk::key_store::client as keystore_client; +use aws_db_esdk::material_providers::client; + +fn is_send(_f: T) {} + +fn example() { + let future = async move { + let kms_key_id = + "random key stuff" + .to_string(); + + // 1. Configure your KeyStore resource. + // This SHOULD be the same configuration that was used to create the DDB table + // in the "Create KeyStore Table 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("KeyStore") + .logical_key_store_name("KeyStore") + .kms_configuration(KmsConfiguration::KmsKeyArn(kms_key_id.clone())) + .build() + .unwrap(); + + let keystore = keystore_client::Client::from_conf(key_store_config).unwrap(); + + let _new_key = keystore.create_key().send().await.unwrap(); + + let provider_config = MaterialProvidersConfig::builder().build().unwrap(); + + let mat_prov = client::Client::from_conf(provider_config).unwrap(); + let _kms_keyring = mat_prov + .create_aws_kms_mrk_multi_keyring() + .generator(kms_key_id) + .send() + .await + .unwrap(); + }; + + is_send(future); +} From a3c110a5b42ba7d90f663ce0379991e68d34c3c3 Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Fri, 10 Jan 2025 12:27:09 -0500 Subject: [PATCH 03/30] m --- .github/workflows/library_rust_tests.yml | 4 ++-- project.properties | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/library_rust_tests.yml b/.github/workflows/library_rust_tests.yml index 10fe5dfcf..581d373f1 100644 --- a/.github/workflows/library_rust_tests.yml +++ b/.github/workflows/library_rust_tests.yml @@ -27,7 +27,7 @@ jobs: id-token: write contents: read env: - RUST_MIN_STACK: 104857600 + RUST_MIN_STACK: 204857600 steps: - name: Support longpaths on Git checkout run: | @@ -57,7 +57,7 @@ jobs: - name: Setup Dafny uses: dafny-lang/setup-dafny-action@v1.7.0 with: - dafny-version: nightly-2024-12-03-4954170 + dafny-version: ${{ inputs.dafny }} # Remove this after the formatting in Rust starts working - name: smithy-dafny Rust hacks diff --git a/project.properties b/project.properties index e4924edf8..f73b1b5d3 100644 --- a/project.properties +++ b/project.properties @@ -1,6 +1,6 @@ projectJavaVersion=3.7.0-SNAPSHOT mplDependencyJavaVersion=1.8.0-SNAPSHOT -dafnyVersion=4.9.0 -dafnyVerifyVersion=4.9.0 -dafnyRuntimeJavaVersion=4.9.0 +dafnyVersion=4.9.1 +dafnyVerifyVersion=4.9.1 +dafnyRuntimeJavaVersion=4.9.1 smithyDafnyJavaConversionVersion=0.1.1 From d765f0017fb9f30417e206fb5fc447c127094491 Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Fri, 10 Jan 2025 13:12:54 -0500 Subject: [PATCH 04/30] m --- .github/workflows/library_rust_tests.yml | 2 +- project.properties | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/library_rust_tests.yml b/.github/workflows/library_rust_tests.yml index 581d373f1..b1a94bff7 100644 --- a/.github/workflows/library_rust_tests.yml +++ b/.github/workflows/library_rust_tests.yml @@ -57,7 +57,7 @@ jobs: - name: Setup Dafny uses: dafny-lang/setup-dafny-action@v1.7.0 with: - dafny-version: ${{ inputs.dafny }} + dafny-version: nightly-2024-12-03-4954170 # Remove this after the formatting in Rust starts working - name: smithy-dafny Rust hacks diff --git a/project.properties b/project.properties index f73b1b5d3..e4924edf8 100644 --- a/project.properties +++ b/project.properties @@ -1,6 +1,6 @@ projectJavaVersion=3.7.0-SNAPSHOT mplDependencyJavaVersion=1.8.0-SNAPSHOT -dafnyVersion=4.9.1 -dafnyVerifyVersion=4.9.1 -dafnyRuntimeJavaVersion=4.9.1 +dafnyVersion=4.9.0 +dafnyVerifyVersion=4.9.0 +dafnyRuntimeJavaVersion=4.9.0 smithyDafnyJavaConversionVersion=0.1.1 From 9b39e1a50d2110d5e2843bf47dc7837b05c437b0 Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Fri, 10 Jan 2025 15:46:20 -0500 Subject: [PATCH 05/30] m --- .github/workflows/library_rust_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/library_rust_tests.yml b/.github/workflows/library_rust_tests.yml index b1a94bff7..e921284a8 100644 --- a/.github/workflows/library_rust_tests.yml +++ b/.github/workflows/library_rust_tests.yml @@ -27,7 +27,7 @@ jobs: id-token: write contents: read env: - RUST_MIN_STACK: 204857600 + RUST_MIN_STACK: 404857600 steps: - name: Support longpaths on Git checkout run: | From 6be36b6c3520a7f26f9e317735d4ff616268839f Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Mon, 13 Jan 2025 15:50:02 -0500 Subject: [PATCH 06/30] m --- DynamoDbEncryption/runtimes/rust/Cargo.toml | 6 +- .../runtimes/rust/src/software_externs.rs | 2 +- .../db_esdk/dafny_runtime_rust/Cargo.toml | 3 + .../db_esdk/dafny_runtime_rust/src/lib.rs | 523 ++++++++++-------- .../dafny_runtime_rust/src/system/mod.rs | 313 +++++++++-- submodules/MaterialProviders | 2 +- submodules/smithy-dafny | 2 +- 7 files changed, 574 insertions(+), 277 deletions(-) diff --git a/DynamoDbEncryption/runtimes/rust/Cargo.toml b/DynamoDbEncryption/runtimes/rust/Cargo.toml index 1e1a134d2..83f05aca9 100644 --- a/DynamoDbEncryption/runtimes/rust/Cargo.toml +++ b/DynamoDbEncryption/runtimes/rust/Cargo.toml @@ -25,7 +25,8 @@ aws-smithy-runtime-api = {version = "1.7.3", features = ["client"] } aws-smithy-types = "1.2.10" chrono = "0.4.39" cpu-time = "1.0.0" -dafny-runtime = "0.1.1" +#dafny-runtime = "0.1.1" +dafny-runtime = { path = "../../../releases/rust/db_esdk/dafny_runtime_rust", features = ["sync"] } dashmap = "6.1.0" pem = "3.0.4" tokio = {version = "1.42.0", features = ["full"] } @@ -33,6 +34,3 @@ uuid = { version = "1.11.0", features = ["v4"] } [[example]] name = "main" - -[features] -async-fixed = [] 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/releases/rust/db_esdk/dafny_runtime_rust/Cargo.toml b/releases/rust/db_esdk/dafny_runtime_rust/Cargo.toml index 92c31d457..579ecb912 100644 --- a/releases/rust/db_esdk/dafny_runtime_rust/Cargo.toml +++ b/releases/rust/db_esdk/dafny_runtime_rust/Cargo.toml @@ -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..75282a33d 100644 --- a/releases/rust/db_esdk/dafny_runtime_rust/src/lib.rs +++ b/releases/rust/db_esdk/dafny_runtime_rust/src/lib.rs @@ -9,20 +9,27 @@ 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,6 +41,33 @@ pub use num::ToPrimitive; pub use num::Zero; pub use std::convert::Into; +#[cfg(not(feature = "sync"))] +pub use ::std::cell::UnsafeCell; + +#[cfg(feature = "sync")] +pub struct UnsafeCell { + data: ::std::cell::UnsafeCell, // UnsafeCell for interior mutability +} +#[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; @@ -64,12 +98,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 +118,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 +127,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 +136,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 +144,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 +611,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 +632,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()), } } } @@ -704,58 +739,46 @@ 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 { @@ -784,8 +807,20 @@ where left, right, } => { + #[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(cache) = borrowed.as_ref() { return Rc::clone(cache); @@ -795,13 +830,12 @@ where let mut array: Vec = Vec::with_capacity(*length); Sequence::::append_recursive(&mut array, self); 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()); + Self::write_cache(boxed, result.clone()); result } } @@ -821,8 +855,20 @@ where } => // 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() { @@ -894,6 +940,28 @@ where } } +#[cfg(feature = "sync")] +impl Sequence +where + T: DafnyType, +{ + fn write_cache(boxed: &Rc>>>>, array: Rc>) { + let mut cache = boxed.lock().unwrap(); + *cache = Some(array.clone()); + } +} + +#[cfg(not(feature = "sync"))] +impl Sequence +where + T: DafnyType, +{ + fn write_cache(boxed: &Rc>>>>, array: Rc>) { + let mut cache = boxed.borrow_mut(); + *cache = Some(array.clone()); + } +} + pub struct SequenceIter { array: Rc>, index: SizeT, @@ -1204,7 +1272,6 @@ impl Map { } } - impl Map { pub fn values(&self) -> Set { let mut result: Vec = Vec::new(); @@ -1735,9 +1802,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() } } @@ -1992,7 +2060,7 @@ impl DafnyPrint for LazyFieldWrapper { // 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> { fn fmt_print(&self, f: &mut ::std::fmt::Formatter<'_>, _in_seq: bool) -> ::std::fmt::Result { write!(f, "") } @@ -2067,7 +2135,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) } } @@ -2336,7 +2408,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 +2446,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 +2626,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 +2638,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 +2652,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 +2660,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 +2743,6 @@ macro_rules! ARRAY_METHODS { }; } - macro_rules! ARRAY_STRUCT { ($ArrayType:ident, $length0: ident, $($length:ident),+) => { pub struct $ArrayType { @@ -2763,25 +2848,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 +2874,7 @@ ARRAY_DEF!{Array5, (length4, length4_usize) } -ARRAY_DEF!{Array6, +ARRAY_DEF! {Array6, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2798,7 +2883,7 @@ ARRAY_DEF!{Array6, (length5, length5_usize) } -ARRAY_DEF!{Array7, +ARRAY_DEF! {Array7, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2808,7 +2893,7 @@ ARRAY_DEF!{Array7, (length6, length6_usize) } -ARRAY_DEF!{Array8, +ARRAY_DEF! {Array8, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2819,7 +2904,7 @@ ARRAY_DEF!{Array8, (length7, length7_usize) } -ARRAY_DEF!{Array9, +ARRAY_DEF! {Array9, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2831,7 +2916,7 @@ ARRAY_DEF!{Array9, (length8, length8_usize) } -ARRAY_DEF!{Array10, +ARRAY_DEF! {Array10, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2844,7 +2929,7 @@ ARRAY_DEF!{Array10, (length9, length9_usize) } -ARRAY_DEF!{Array11, +ARRAY_DEF! {Array11, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2858,7 +2943,7 @@ ARRAY_DEF!{Array11, (length10, length10_usize) } -ARRAY_DEF!{Array12, +ARRAY_DEF! {Array12, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2873,7 +2958,7 @@ ARRAY_DEF!{Array12, (length11, length11_usize) } -ARRAY_DEF!{Array13, +ARRAY_DEF! {Array13, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2889,7 +2974,7 @@ ARRAY_DEF!{Array13, (length12, length12_usize) } -ARRAY_DEF!{Array14, +ARRAY_DEF! {Array14, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2906,7 +2991,7 @@ ARRAY_DEF!{Array14, (length13, length13_usize) } -ARRAY_DEF!{Array15, +ARRAY_DEF! {Array15, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2924,7 +3009,7 @@ ARRAY_DEF!{Array15, (length14, length14_usize) } -ARRAY_DEF!{Array16, +ARRAY_DEF! {Array16, (length0, length0_usize), (length1, length1_usize), (length2, length2_usize), @@ -2945,10 +3030,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]> { @@ -3125,7 +3212,6 @@ macro_rules! cast_any_object { }; } - // 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 +3247,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 +3326,7 @@ macro_rules! update_field_mut_if_uninit { // This Ptr has the same run-time space as *mut pub struct Ptr(pub Option>>); -impl Ptr { +impl Ptr { pub fn null() -> Self { Ptr(None) } @@ -3252,7 +3335,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,7 +3354,7 @@ impl Ptr { } } -impl > Ptr { +impl> Ptr { pub fn is_instance_of(self) -> bool { if self.is_null() { false @@ -3285,13 +3373,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 +3387,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 +3400,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 +3427,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 +3437,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 +3478,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 +3490,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 + // 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,7 +3511,7 @@ impl Clone for Object { } } -impl Default for Object { +impl Default for Object { fn default() -> Self { Object(None) } @@ -3440,7 +3522,7 @@ impl> Debug for Object { 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 option_string = obj_any.as_ref().downcast_ref::(); @@ -3451,7 +3533,7 @@ 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, "") } @@ -3464,7 +3546,7 @@ impl UpcastObject for String { } } -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 +3564,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 +3574,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 +3591,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 +3616,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 +3630,14 @@ pub fn allocate_object() -> Object { } pub struct AllocationTracker { - allocations: Vec> + allocations: Vec>, } 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 +3645,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 +3656,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 +3729,6 @@ macro_rules! update_field_mut_uninit_object { }}; } - // Equivalent of modify but for rcmut #[macro_export] macro_rules! md { @@ -3657,24 +3748,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,21 +3773,34 @@ 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; - pub fn new(val: T) -> crate::Object { - crate::Object(Some(crate::rcmut::new(val))) - } + #[cfg(not(feature = "sync"))] pub fn downcast(_self: crate::Object) -> crate::Object { unsafe { - crate::Object(Some(crate::rcmut::downcast::(_self.0.unwrap()).unwrap())) // Use unwrap_unchecked? + crate::Object(Some(crate::rcmut::downcast::(_self.0.unwrap()).unwrap())) + // Use unwrap_unchecked? } } + + #[cfg(feature = "sync")] + pub fn downcast( + _self: crate::Object, + ) -> crate::Object { + unsafe { + crate::Object(Some(crate::rcmut::downcast::(_self.0.unwrap()).unwrap())) + // Use unwrap_unchecked? + } + } + + pub fn new(val: T) -> crate::Object { + crate::Object(Some(crate::rcmut::new(val))) + } #[inline] pub fn is(_self: crate::Object) -> bool { is_object!(_self, T) @@ -3709,10 +3809,9 @@ pub mod object { // 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 +3873,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 +3947,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 +3985,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 +4002,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 +4018,6 @@ pub trait UpcastBox { fn upcast(&self) -> Box; } - #[macro_export] macro_rules! Extends { ($traitType: tt) => { @@ -4006,8 +4073,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 +4088,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 +4103,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 +4121,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 +4133,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..5397a3827 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 @@ -8,7 +8,7 @@ pub mod _System { pub use ::std::fmt::Formatter; pub use ::std::fmt::Result; pub use crate::DafnyPrint; - pub use ::std::rc::Rc; + #[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; @@ -28,11 +28,13 @@ pub mod _System { } 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, @@ -64,8 +66,9 @@ pub mod _System { } 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{ + /// 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 { @@ -137,6 +140,7 @@ pub mod _System { } impl Tuple0 { + /// Enumerates all possible values of Tuple0 pub fn _AllSingletonConstructors() -> SequenceIter> { seq![Rc::new(Tuple0::_T0 {})].iter() } @@ -178,6 +182,7 @@ pub mod _System { } impl Tuple1 { + /// Returns a borrow of the field _0 pub fn _0(&self) -> &T0 { match self { Tuple1::_T1{_0, } => _0, @@ -207,8 +212,9 @@ pub mod _System { } impl Tuple1 { - pub fn coerce(f_0: Rc r#__T0 + 'static>) -> Rc) -> Tuple1> { - Rc::new(move |this: Self| -> 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 { @@ -260,16 +266,19 @@ pub mod _System { } 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, @@ -303,8 +312,9 @@ pub mod _System { } 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{ + /// 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 { @@ -363,21 +373,25 @@ pub mod _System { } 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, @@ -413,8 +427,9 @@ pub mod _System { } 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{ + /// 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 { @@ -477,26 +492,31 @@ pub mod _System { } 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, @@ -534,8 +554,9 @@ pub mod _System { } 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{ + /// 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 { @@ -602,31 +623,37 @@ pub mod _System { } 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, @@ -666,8 +693,9 @@ pub mod _System { } 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{ + /// 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 { @@ -738,36 +766,43 @@ pub mod _System { } 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, @@ -809,8 +844,9 @@ pub mod _System { } 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{ + /// 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 { @@ -885,41 +921,49 @@ pub mod _System { } 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, @@ -963,8 +1007,9 @@ pub mod _System { } 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{ + /// 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 { @@ -1043,46 +1088,55 @@ pub mod _System { } 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, @@ -1128,8 +1182,9 @@ pub mod _System { } 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{ + /// 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 { @@ -1212,51 +1267,61 @@ pub mod _System { } 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, @@ -1304,8 +1369,9 @@ pub mod _System { } 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{ + /// 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 { @@ -1392,56 +1458,67 @@ pub mod _System { } 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, @@ -1491,8 +1568,9 @@ pub mod _System { } 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{ + /// 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 { @@ -1583,61 +1661,73 @@ pub mod _System { } 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, @@ -1689,8 +1779,9 @@ pub mod _System { } 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{ + /// 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 { @@ -1785,66 +1876,79 @@ pub mod _System { } 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, @@ -1898,8 +2002,9 @@ pub mod _System { } 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{ + /// 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 { @@ -1998,71 +2103,85 @@ pub mod _System { } 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, @@ -2118,8 +2237,9 @@ pub mod _System { } 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{ + /// 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 { @@ -2222,76 +2342,91 @@ pub mod _System { } 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, @@ -2349,8 +2484,9 @@ pub mod _System { } 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{ + /// 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 { @@ -2457,81 +2593,97 @@ pub mod _System { } 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, @@ -2591,8 +2743,9 @@ pub mod _System { } 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{ + /// 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 { @@ -2703,86 +2856,103 @@ pub mod _System { } 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, @@ -2844,8 +3014,9 @@ pub mod _System { } 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{ + /// 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 { @@ -2960,91 +3131,109 @@ pub mod _System { } 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, @@ -3108,8 +3297,9 @@ pub mod _System { } 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{ + /// 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 { @@ -3228,96 +3418,115 @@ pub mod _System { } 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, @@ -3383,8 +3592,9 @@ pub mod _System { } 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{ + /// 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 { @@ -3507,101 +3717,121 @@ pub mod _System { } 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, @@ -3669,8 +3899,9 @@ pub mod _System { } 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{ + /// 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 { diff --git a/submodules/MaterialProviders b/submodules/MaterialProviders index 1915a11bb..fd860763d 160000 --- a/submodules/MaterialProviders +++ b/submodules/MaterialProviders @@ -1 +1 @@ -Subproject commit 1915a11bb84d3d9135b89d2a46ec9d6dff27b493 +Subproject commit fd860763d39e9524b667627c12050b110626a21a diff --git a/submodules/smithy-dafny b/submodules/smithy-dafny index f67c21075..c9d0aac30 160000 --- a/submodules/smithy-dafny +++ b/submodules/smithy-dafny @@ -1 +1 @@ -Subproject commit f67c21075ebac40e052204b6827a4db641e65862 +Subproject commit c9d0aac30961d73e2503a36fdf5209c161678dd6 From 82aefc7b1f9cc75a346944396c6caabaee77b73d Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Tue, 21 Jan 2025 14:49:53 -0500 Subject: [PATCH 07/30] m --- .../runtimes/rust/examples/basic_async.rs | 7 +- .../runtimes/rust/examples/main.rs | 2 +- .../db_esdk/dafny_runtime_rust/src/lib.rs | 132 +++++++++--------- .../dafny_runtime_rust/src/tests/mod.rs | 15 ++ submodules/MaterialProviders | 2 +- submodules/smithy-dafny | 2 +- 6 files changed, 86 insertions(+), 74 deletions(-) diff --git a/DynamoDbEncryption/runtimes/rust/examples/basic_async.rs b/DynamoDbEncryption/runtimes/rust/examples/basic_async.rs index f44aab333..363877f1c 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/basic_async.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/basic_async.rs @@ -1,16 +1,13 @@ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -use std::future::Future; use aws_db_esdk::key_store::types::KeyStoreConfig; use aws_db_esdk::key_store::types::KmsConfiguration; use aws_db_esdk::material_providers::types::MaterialProvidersConfig; use aws_db_esdk::key_store::client as keystore_client; use aws_db_esdk::material_providers::client; -fn is_send(_f: T) {} - -fn example() { +pub async fn example() { let future = async move { let kms_key_id = "random key stuff" @@ -44,5 +41,5 @@ fn example() { .unwrap(); }; - is_send(future); + future.await; } diff --git a/DynamoDbEncryption/runtimes/rust/examples/main.rs b/DynamoDbEncryption/runtimes/rust/examples/main.rs index 0825f1841..ef93f66e6 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/main.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/main.rs @@ -15,7 +15,6 @@ pub mod multi_get_put_example; pub mod searchableencryption; pub mod test_utils; -#[cfg(feature = "async-fixed")] pub mod basic_async; use std::convert::From; @@ -50,6 +49,7 @@ impl From for BoxError { #[tokio::main] pub async fn main() -> Result<(), BoxError2> { + basic_async::example().await; basic_get_put_example::put_item_get_item().await?; itemencryptor::item_encrypt_decrypt::encrypt_decrypt().await?; get_encrypted_data_key_description::get_encrypted_data_key_description().await?; 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 75282a33d..f6e0712f1 100644 --- a/releases/rust/db_esdk/dafny_runtime_rust/src/lib.rs +++ b/releases/rust/db_esdk/dafny_runtime_rust/src/lib.rs @@ -6,7 +6,6 @@ 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, clone::Clone, @@ -41,6 +40,15 @@ 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; @@ -812,10 +820,10 @@ where #[cfg(feature = "sync")] let into_boxed_borrowed = into_boxed; #[cfg(feature = "sync")] - let guard = into_boxed_borrowed.lock().unwrap(); + let mut 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"))] @@ -828,19 +836,38 @@ where // 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, &borrowed, left, right); let result = Rc::new(array); 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!() }; - Self::write_cache(boxed, result.clone()); + #[cfg(not(feature = "sync"))] + let mut guard = boxed.borrow_mut(); + *guard = Some(result.clone()); result } } } + pub fn append_recursive_safe( + array: &mut Vec, + borrowed: &Option<&Rc>>, + left: &Rc>>, + right: &Rc>>, + ) { + 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() }); + } + pub fn append_recursive(array: &mut Vec, this: &Sequence) { match this { Sequence::ArraySequence { values, .. } => @@ -863,7 +890,7 @@ where 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"))] @@ -940,28 +967,6 @@ where } } -#[cfg(feature = "sync")] -impl Sequence -where - T: DafnyType, -{ - fn write_cache(boxed: &Rc>>>>, array: Rc>) { - let mut cache = boxed.lock().unwrap(); - *cache = Some(array.clone()); - } -} - -#[cfg(not(feature = "sync"))] -impl Sequence -where - T: DafnyType, -{ - fn write_cache(boxed: &Rc>>>>, array: Rc>) { - let mut cache = boxed.borrow_mut(); - *cache = Some(array.clone()); - } -} - pub struct SequenceIter { array: Rc>, index: SizeT, @@ -2178,7 +2183,7 @@ impl DafnyPrint for () { } } -#[derive(Clone)] +#[derive(Clone, Copy)] pub struct DafnyCharUTF16(pub u16); pub type DafnyStringUTF16 = Sequence; @@ -2254,7 +2259,7 @@ impl Sub for DafnyCharUTF16 { } } -#[derive(Clone)] +#[derive(Clone, Copy)] pub struct DafnyChar(pub char); pub type DafnyString = Sequence; @@ -3200,7 +3205,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)* @@ -3208,10 +3213,11 @@ 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 @@ -3354,12 +3360,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() } @@ -3490,10 +3496,10 @@ 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))) + rd!(UpcastObject::::upcast(rd!(self))) .downcast_ref::() .is_some() } @@ -3517,14 +3523,14 @@ impl Default for Object { } } -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), @@ -3538,11 +3544,10 @@ impl DafnyPrint for Object<[T]> { 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) } } } @@ -3630,9 +3635,18 @@ 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 @@ -3778,31 +3792,17 @@ macro_rules! refcount { } pub mod object { - use std::any::Any; - - #[cfg(not(feature = "sync"))] - pub fn downcast(_self: crate::Object) -> crate::Object { - unsafe { - crate::Object(Some(crate::rcmut::downcast::(_self.0.unwrap()).unwrap())) - // Use unwrap_unchecked? - } - } + use crate::{Any, DynAny}; - #[cfg(feature = "sync")] - pub fn downcast( - _self: crate::Object, - ) -> crate::Object { - unsafe { - crate::Object(Some(crate::rcmut::downcast::(_self.0.unwrap()).unwrap())) - // Use unwrap_unchecked? - } + 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))) } #[inline] - pub fn is(_self: crate::Object) -> bool { + pub fn is(_self: crate::Object) -> bool { is_object!(_self, T) } } @@ -3875,16 +3875,16 @@ pub mod rcmut { #[cfg(feature = "sync")] pub unsafe fn downcast( - this: RcMut, + this: RcMut, ) -> Option> { - let t: Rc = to_rc(this); + let t: Rc = to_rc(this); let t: Rc = Rc::downcast::(t).ok()?; mem::transmute(t) } #[cfg(not(feature = "sync"))] - pub unsafe fn downcast(this: RcMut) -> Option> { - let t: Rc = to_rc(this); + pub unsafe fn downcast(this: RcMut) -> Option> { + let t: Rc = to_rc(this); let t: Rc = Rc::downcast::(t).ok()?; mem::transmute(t) } 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..c49d08c08 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 @@ -44,7 +44,10 @@ mod tests { assert_eq!(*length, 6); assert_eq!(unsafe { &*left.get() }.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().clone().borrow().lock().unwrap().as_ref().is_none()); } _ => panic!("This should never happen"), } @@ -1022,6 +1025,18 @@ 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 fd860763d..39b221502 160000 --- a/submodules/MaterialProviders +++ b/submodules/MaterialProviders @@ -1 +1 @@ -Subproject commit fd860763d39e9524b667627c12050b110626a21a +Subproject commit 39b22150291e5ff6703c101c227cbffc0a134c37 diff --git a/submodules/smithy-dafny b/submodules/smithy-dafny index c9d0aac30..b69c1893e 160000 --- a/submodules/smithy-dafny +++ b/submodules/smithy-dafny @@ -1 +1 @@ -Subproject commit c9d0aac30961d73e2503a36fdf5209c161678dd6 +Subproject commit b69c1893ec30c950111726240de91b889280205e From a3b98370db6b51332004e5cc719718f99b348ade Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Wed, 22 Jan 2025 10:23:12 -0500 Subject: [PATCH 08/30] m --- .../runtimes/rust/examples/basic_async.rs | 45 -- .../rust/examples/basic_get_put_example.rs | 4 +- .../clientsupplier/client_supplier_example.rs | 4 +- .../regional_role_client_supplier.rs | 2 +- .../itemencryptor/item_encrypt_decrypt.rs | 4 +- .../examples/keyring/hierarchical_keyring.rs | 4 +- .../rust/examples/keyring/kms_rsa_keyring.rs | 6 +- .../keyring/mrk_discovery_multi_keyring.rs | 4 +- .../rust/examples/keyring/multi_keyring.rs | 4 +- .../examples/keyring/multi_mrk_keyring.rs | 4 +- .../rust/examples/keyring/raw_aes_keyring.rs | 4 +- .../rust/examples/keyring/raw_rsa_keyring.rs | 4 +- .../runtimes/rust/examples/main.rs | 1 - .../rust/examples/multi_get_put_example.rs | 4 +- .../basic_searchable_encryption.rs | 568 +++++++++--------- .../beacon_styles_searchable_encryption.rs | 4 +- .../complexexample/beacon_config.rs | 4 +- .../compound_beacon_searchable_encryption.rs | 6 +- .../virtual_beacon_searchable_encryption.rs | 6 +- .../runtimes/rust/src/intercept.rs | 3 +- DynamoDbEncryption/runtimes/rust/src/lib.rs | 44 +- .../db_esdk/dafny_runtime_rust/src/lib.rs | 8 + 22 files changed, 352 insertions(+), 385 deletions(-) delete mode 100644 DynamoDbEncryption/runtimes/rust/examples/basic_async.rs diff --git a/DynamoDbEncryption/runtimes/rust/examples/basic_async.rs b/DynamoDbEncryption/runtimes/rust/examples/basic_async.rs deleted file mode 100644 index 363877f1c..000000000 --- a/DynamoDbEncryption/runtimes/rust/examples/basic_async.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -use aws_db_esdk::key_store::types::KeyStoreConfig; -use aws_db_esdk::key_store::types::KmsConfiguration; -use aws_db_esdk::material_providers::types::MaterialProvidersConfig; -use aws_db_esdk::key_store::client as keystore_client; -use aws_db_esdk::material_providers::client; - -pub async fn example() { - let future = async move { - let kms_key_id = - "random key stuff" - .to_string(); - - // 1. Configure your KeyStore resource. - // This SHOULD be the same configuration that was used to create the DDB table - // in the "Create KeyStore Table 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("KeyStore") - .logical_key_store_name("KeyStore") - .kms_configuration(KmsConfiguration::KmsKeyArn(kms_key_id.clone())) - .build() - .unwrap(); - - let keystore = keystore_client::Client::from_conf(key_store_config).unwrap(); - - let _new_key = keystore.create_key().send().await.unwrap(); - - let provider_config = MaterialProvidersConfig::builder().build().unwrap(); - - let mat_prov = client::Client::from_conf(provider_config).unwrap(); - let _kms_keyring = mat_prov - .create_aws_kms_mrk_multi_keyring() - .generator(kms_key_id) - .send() - .await - .unwrap(); - }; - - future.await; -} 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/main.rs b/DynamoDbEncryption/runtimes/rust/examples/main.rs index ef93f66e6..d8e603fb6 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/main.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/main.rs @@ -49,7 +49,6 @@ impl From for BoxError { #[tokio::main] pub async fn main() -> Result<(), BoxError2> { - basic_async::example().await; basic_get_put_example::put_item_get_item().await?; itemencryptor::item_encrypt_decrypt::encrypt_decrypt().await?; get_encrypted_data_key_description::get_encrypted_data_key_description().await?; 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 7c78888c1..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,12 +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; pub use client::Client; pub use types::dynamo_db_tables_encryption_config::DynamoDbTablesEncryptionConfig; @@ -93,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; @@ -124,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/releases/rust/db_esdk/dafny_runtime_rust/src/lib.rs b/releases/rust/db_esdk/dafny_runtime_rust/src/lib.rs index f6e0712f1..7d9938bda 100644 --- a/releases/rust/db_esdk/dafny_runtime_rust/src/lib.rs +++ b/releases/rust/db_esdk/dafny_runtime_rust/src/lib.rs @@ -79,8 +79,16 @@ impl UnsafeCell { // An atomic box is just a RefCell in Rust pub type SizeT = usize; +#[cfg(feature = "sync")] +pub trait DafnyType: Clone + DafnyPrint + Send + Sync + 'static {} + +#[cfg(not(feature = "sync"))] pub trait DafnyType: Clone + DafnyPrint + 'static {} +#[cfg(feature = "sync")] +impl DafnyType for T where T: Clone + DafnyPrint + Send + Sync + 'static {} + +#[cfg(not(feature = "sync"))] impl DafnyType for T where T: Clone + DafnyPrint + 'static {} pub trait DafnyTypeEq: DafnyType + Hash + Eq {} From 2c9c3224be5917249a7b4f3fddc3cc09a2458fa1 Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Wed, 22 Jan 2025 10:31:37 -0500 Subject: [PATCH 09/30] m --- .../db_esdk/dafny_runtime_rust/src/lib.rs | 26 +++++-- .../dafny_runtime_rust/src/tests/mod.rs | 70 ++++++++++++------- 2 files changed, 66 insertions(+), 30 deletions(-) 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 7d9938bda..77f789abc 100644 --- a/releases/rust/db_esdk/dafny_runtime_rust/src/lib.rs +++ b/releases/rust/db_esdk/dafny_runtime_rust/src/lib.rs @@ -79,17 +79,16 @@ impl UnsafeCell { // 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"))] -pub trait DafnyType: Clone + DafnyPrint + 'static {} - +impl DafnyType for T where T: Clone + DafnyPrint + 'static {} #[cfg(feature = "sync")] impl DafnyType for T where T: Clone + DafnyPrint + Send + Sync + 'static {} -#[cfg(not(feature = "sync"))] -impl DafnyType for T where T: Clone + DafnyPrint + 'static {} pub trait DafnyTypeEq: DafnyType + Hash + Eq {} impl DafnyTypeEq for T where T: DafnyType + Hash + Eq {} @@ -2070,6 +2069,18 @@ 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 $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)*) => { @@ -2080,6 +2091,7 @@ macro_rules! dafny_print_function { } } } + // 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)*) => { @@ -3340,6 +3352,12 @@ macro_rules! update_field_mut_if_uninit { // This Ptr has the same run-time space as *mut pub struct Ptr(pub Option>>); +#[cfg(feature = "sync")] +unsafe impl Send for Ptr {} + +#[cfg(feature = "sync")] +unsafe impl Sync for Ptr {} + impl Ptr { pub fn null() -> Self { Ptr(None) 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 c49d08c08..7b252cce4 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 @@ -47,7 +47,7 @@ mod tests { #[cfg(not(feature = "sync"))] assert!(boxed.as_ref().clone().borrow().as_ref().is_none()); #[cfg(feature = "sync")] - assert!(boxed.as_ref().clone().borrow().lock().unwrap().as_ref().is_none()); + assert!(boxed.as_ref().lock().unwrap().as_ref().is_none()); } _ => panic!("This should never happen"), } @@ -55,10 +55,16 @@ mod tests { assert_eq!(value, 1); match &concat { crate::Sequence::ConcatSequence { 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"), } @@ -443,11 +449,11 @@ mod tests { } } - 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] @@ -549,19 +555,19 @@ 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::, 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::, 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::, crate::DynAny>())(map_o); assert_eq!(cast!(map_a.get(&1), ClassWrapper), o); deallocate(o); } @@ -594,7 +600,7 @@ mod tests { #[test] fn test_function_wrappers() { - let f: Rc i32> = Rc::new(|i: i32| i + 1); + let f: Rc i32 + Send + Sync> = Rc::new(|i: i32| i + 1); let g = f.clone(); let _h = seq![g]; } @@ -688,10 +694,22 @@ mod tests { let count_inner = count.clone(); multiset!{1, 1, 5, 7, 8} .iter().for_each(move |_i: u32| { - let c: i32 = *count_inner.as_ref().borrow(); - *count_inner.borrow_mut() = c + 1; + #[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(); @@ -748,7 +766,7 @@ mod tests { assert_eq!(sum, 55); } - trait SuperTrait: Upcast + UpcastObject { + trait SuperTrait: Upcast + UpcastObject { } trait NodeRcMutTrait: SuperTrait + Upcast + UpcastObject{ @@ -767,11 +785,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); @@ -798,7 +816,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); @@ -834,7 +852,7 @@ 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()); } @@ -850,8 +868,8 @@ 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 {} @@ -863,7 +881,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); @@ -907,13 +925,13 @@ mod tests { 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 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!"); @@ -923,7 +941,7 @@ 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); } From ec168d36c60bf8cb338958b752d38134b96cb7b8 Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Wed, 22 Jan 2025 10:32:16 -0500 Subject: [PATCH 10/30] m --- submodules/smithy-dafny | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/smithy-dafny b/submodules/smithy-dafny index b69c1893e..81c2f608c 160000 --- a/submodules/smithy-dafny +++ b/submodules/smithy-dafny @@ -1 +1 @@ -Subproject commit b69c1893ec30c950111726240de91b889280205e +Subproject commit 81c2f608c6cfefe9efd1c617d7005d14d8b11b38 From 7ef991f4c1e73c7021ff2c8b1146410325f87da6 Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Thu, 23 Jan 2025 14:05:53 -0500 Subject: [PATCH 11/30] m --- .github/workflows/library_rust_tests.yml | 6 ++++-- TestVectors/runtimes/rust/Cargo.toml | 2 +- submodules/MaterialProviders | 2 +- submodules/smithy-dafny | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/library_rust_tests.yml b/.github/workflows/library_rust_tests.yml index b355e4572..61a7dce01 100644 --- a/.github/workflows/library_rust_tests.yml +++ b/.github/workflows/library_rust_tests.yml @@ -59,10 +59,12 @@ jobs: # - name: Rustfmt Check # uses: actions-rust-lang/rustfmt@v1 + # TODO: Use setup-dafny-actions with correct version when Dafny releases 4.8.2 - name: Setup Dafny - uses: dafny-lang/setup-dafny-action@v1.7.0 + # uses: dafny-lang/setup-dafny-action@v1.7.0 + uses: ./submodules/smithy-dafny/.github/actions/build_dafny_from_source with: - dafny-version: nightly-2024-12-03-4954170 + dafny: d07403b6d6606257e1b5aada4d0156901f4a17de - name: Update MPL submodule if using MPL HEAD if: ${{ inputs.mpl-head == true }} diff --git a/TestVectors/runtimes/rust/Cargo.toml b/TestVectors/runtimes/rust/Cargo.toml index 5a440c1e3..afd62c908 100644 --- a/TestVectors/runtimes/rust/Cargo.toml +++ b/TestVectors/runtimes/rust/Cargo.toml @@ -16,7 +16,7 @@ aws-smithy-runtime-api = {version = "1.7.3", features = ["client"] } aws-smithy-types = "1.2.10" 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/MaterialProviders/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"] } diff --git a/submodules/MaterialProviders b/submodules/MaterialProviders index 39b221502..ed851625e 160000 --- a/submodules/MaterialProviders +++ b/submodules/MaterialProviders @@ -1 +1 @@ -Subproject commit 39b22150291e5ff6703c101c227cbffc0a134c37 +Subproject commit ed851625e9c31557ab90674c42c7c2a49f48ea22 diff --git a/submodules/smithy-dafny b/submodules/smithy-dafny index 81c2f608c..89aed9c9d 160000 --- a/submodules/smithy-dafny +++ b/submodules/smithy-dafny @@ -1 +1 @@ -Subproject commit 81c2f608c6cfefe9efd1c617d7005d14d8b11b38 +Subproject commit 89aed9c9d6e51ef9c7031c966855a7566267dd14 From 6a06c59edccab8ef6246eb46daed6696e9e7abc4 Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Thu, 23 Jan 2025 14:08:32 -0500 Subject: [PATCH 12/30] m --- .github/workflows/library_rust_tests.yml | 2 +- .github/workflows/smithy-diff.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/library_rust_tests.yml b/.github/workflows/library_rust_tests.yml index 61a7dce01..96ec42b22 100644 --- a/.github/workflows/library_rust_tests.yml +++ b/.github/workflows/library_rust_tests.yml @@ -59,7 +59,7 @@ jobs: # - name: Rustfmt Check # uses: actions-rust-lang/rustfmt@v1 - # TODO: Use setup-dafny-actions with correct version when Dafny releases 4.8.2 + # Use setup-dafny-actions with correct version when Dafny releases 4.8.2 - name: Setup Dafny # uses: dafny-lang/setup-dafny-action@v1.7.0 uses: ./submodules/smithy-dafny/.github/actions/build_dafny_from_source diff --git a/.github/workflows/smithy-diff.yml b/.github/workflows/smithy-diff.yml index 3092c9470..8128520c6 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\"}" From f2b69a5451c7d663f404ce0f2bfdcc59813e5c5f Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Thu, 23 Jan 2025 14:40:52 -0500 Subject: [PATCH 13/30] m --- submodules/smithy-dafny | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/smithy-dafny b/submodules/smithy-dafny index 89aed9c9d..0cc71ac9e 160000 --- a/submodules/smithy-dafny +++ b/submodules/smithy-dafny @@ -1 +1 @@ -Subproject commit 89aed9c9d6e51ef9c7031c966855a7566267dd14 +Subproject commit 0cc71ac9e55f23ab97583718ba8cebc11e9bda2e From aabce34d45e7d52ed5bf6d5514fe8f5cb0b082bd Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Thu, 23 Jan 2025 15:17:10 -0500 Subject: [PATCH 14/30] m --- .github/workflows/library_rust_tests.yml | 7 +++---- DynamoDbEncryption/runtimes/rust/examples/main.rs | 2 -- submodules/smithy-dafny | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/library_rust_tests.yml b/.github/workflows/library_rust_tests.yml index 96ec42b22..1cc643ef4 100644 --- a/.github/workflows/library_rust_tests.yml +++ b/.github/workflows/library_rust_tests.yml @@ -61,10 +61,9 @@ jobs: # Use setup-dafny-actions with correct version when Dafny releases 4.8.2 - name: Setup Dafny - # uses: dafny-lang/setup-dafny-action@v1.7.0 - uses: ./submodules/smithy-dafny/.github/actions/build_dafny_from_source - with: - dafny: d07403b6d6606257e1b5aada4d0156901f4a17de + uses: https://github.com/dafny-lang/setup-dafny-action/commit/03b219c5a4f71cfe24cb9e02b69d4a622449adbb + with: + build-from-source: d07403b6d6606257e1b5aada4d0156901f4a17de - name: Update MPL submodule if using MPL HEAD if: ${{ inputs.mpl-head == true }} diff --git a/DynamoDbEncryption/runtimes/rust/examples/main.rs b/DynamoDbEncryption/runtimes/rust/examples/main.rs index d8e603fb6..f82979bcb 100644 --- a/DynamoDbEncryption/runtimes/rust/examples/main.rs +++ b/DynamoDbEncryption/runtimes/rust/examples/main.rs @@ -15,8 +15,6 @@ pub mod multi_get_put_example; pub mod searchableencryption; pub mod test_utils; -pub mod basic_async; - use std::convert::From; // Why two types? diff --git a/submodules/smithy-dafny b/submodules/smithy-dafny index 0cc71ac9e..ce7339311 160000 --- a/submodules/smithy-dafny +++ b/submodules/smithy-dafny @@ -1 +1 @@ -Subproject commit 0cc71ac9e55f23ab97583718ba8cebc11e9bda2e +Subproject commit ce7339311ba625a7b41a9cfca5854d5bb542114f From a0e916bc8fdd28fa32f834d81578208bd225caee Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Thu, 23 Jan 2025 15:21:35 -0500 Subject: [PATCH 15/30] m --- .github/workflows/library_rust_tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/library_rust_tests.yml b/.github/workflows/library_rust_tests.yml index 1cc643ef4..37a54781d 100644 --- a/.github/workflows/library_rust_tests.yml +++ b/.github/workflows/library_rust_tests.yml @@ -61,8 +61,9 @@ jobs: # Use setup-dafny-actions with correct version when Dafny releases 4.8.2 - name: Setup Dafny - uses: https://github.com/dafny-lang/setup-dafny-action/commit/03b219c5a4f71cfe24cb9e02b69d4a622449adbb - with: + uses: dafny-lang/setup-dafny-action@03b219c5a4f71cfe24cb9e02b69d4a622449adbb + with: + dafny-version: 4.9.2 build-from-source: d07403b6d6606257e1b5aada4d0156901f4a17de - name: Update MPL submodule if using MPL HEAD From 4e79f5921405df3e8d1fdca3fbf22dd7f2cfeb10 Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Fri, 24 Jan 2025 16:46:04 -0500 Subject: [PATCH 16/30] m --- .github/workflows/library_rust_tests.yml | 4 ++-- submodules/MaterialProviders | 2 +- submodules/smithy-dafny | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/library_rust_tests.yml b/.github/workflows/library_rust_tests.yml index 37a54781d..e07298a9c 100644 --- a/.github/workflows/library_rust_tests.yml +++ b/.github/workflows/library_rust_tests.yml @@ -61,10 +61,10 @@ jobs: # Use setup-dafny-actions with correct version when Dafny releases 4.8.2 - name: Setup Dafny - uses: dafny-lang/setup-dafny-action@03b219c5a4f71cfe24cb9e02b69d4a622449adbb + uses: ./submodules/smithy-dafny/.github/actions/build_dafny_from_source with: dafny-version: 4.9.2 - build-from-source: d07403b6d6606257e1b5aada4d0156901f4a17de + ref: 867e0e262e8b939f6a1b1260fccec71613dbcc30 - name: Update MPL submodule if using MPL HEAD if: ${{ inputs.mpl-head == true }} diff --git a/submodules/MaterialProviders b/submodules/MaterialProviders index ed851625e..470dc9597 160000 --- a/submodules/MaterialProviders +++ b/submodules/MaterialProviders @@ -1 +1 @@ -Subproject commit ed851625e9c31557ab90674c42c7c2a49f48ea22 +Subproject commit 470dc9597fda7799c8a463c031e43682089e55ed diff --git a/submodules/smithy-dafny b/submodules/smithy-dafny index ce7339311..a926e5d5b 160000 --- a/submodules/smithy-dafny +++ b/submodules/smithy-dafny @@ -1 +1 @@ -Subproject commit ce7339311ba625a7b41a9cfca5854d5bb542114f +Subproject commit a926e5d5b23650c7c21f3b804efaf364d002a282 From 368d53f8323e8fa3d9e6f829ad5367469fbcecd7 Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Tue, 28 Jan 2025 10:56:55 -0500 Subject: [PATCH 17/30] m --- .github/workflows/library_rust_tests.yml | 2 +- submodules/MaterialProviders | 2 +- submodules/smithy-dafny | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/library_rust_tests.yml b/.github/workflows/library_rust_tests.yml index e07298a9c..58cd88b32 100644 --- a/.github/workflows/library_rust_tests.yml +++ b/.github/workflows/library_rust_tests.yml @@ -64,7 +64,7 @@ jobs: uses: ./submodules/smithy-dafny/.github/actions/build_dafny_from_source with: dafny-version: 4.9.2 - ref: 867e0e262e8b939f6a1b1260fccec71613dbcc30 + ref: a928ebf5733dca040cbbb9b0c5861c20fb5bff6d - name: Update MPL submodule if using MPL HEAD if: ${{ inputs.mpl-head == true }} diff --git a/submodules/MaterialProviders b/submodules/MaterialProviders index 470dc9597..138558c10 160000 --- a/submodules/MaterialProviders +++ b/submodules/MaterialProviders @@ -1 +1 @@ -Subproject commit 470dc9597fda7799c8a463c031e43682089e55ed +Subproject commit 138558c10d577d1f7b789851e572dc09df99597a diff --git a/submodules/smithy-dafny b/submodules/smithy-dafny index a926e5d5b..506fad167 160000 --- a/submodules/smithy-dafny +++ b/submodules/smithy-dafny @@ -1 +1 @@ -Subproject commit a926e5d5b23650c7c21f3b804efaf364d002a282 +Subproject commit 506fad167333044ffb0dc51ca24e3967ebf8a290 From 1a90c5cbdf8d0c65eac6ef1d235adda4a8b0a20c Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Tue, 28 Jan 2025 11:17:33 -0500 Subject: [PATCH 18/30] m --- .../db_esdk/dafny_runtime_rust/src/lib.rs | 131 +- .../dafny_runtime_rust/src/system/mod.rs | 7995 +++++++++-------- .../dafny_runtime_rust/src/tests/mod.rs | 209 +- 3 files changed, 4209 insertions(+), 4126 deletions(-) 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 77f789abc..1598acc51 100644 --- a/releases/rust/db_esdk/dafny_runtime_rust/src/lib.rs +++ b/releases/rust/db_esdk/dafny_runtime_rust/src/lib.rs @@ -56,6 +56,9 @@ pub use ::std::cell::UnsafeCell; 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")] @@ -740,10 +743,10 @@ where values: Rc>, }, ConcatSequence { - left: Rc>>, - right: Rc>>, + left: Rc>>, + right: Rc>>, length: SizeT, - boxed: Rc>>>>, + cache: Rc>>>>, }, } @@ -800,12 +803,12 @@ where 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> { @@ -818,40 +821,49 @@ where } Sequence::ConcatSequence { length, - boxed, + cache, left, right, } => { #[cfg(feature = "sync")] - let into_boxed = boxed.as_ref(); - #[cfg(feature = "sync")] - let into_boxed_borrowed = into_boxed; - #[cfg(feature = "sync")] - let mut guard = into_boxed_borrowed.lock().unwrap(); - #[cfg(feature = "sync")] - let borrowed: Option<&Rc>> = guard.as_ref(); + { + 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 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(cache) = borrowed.as_ref() { - return Rc::clone(cache); + { + 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_safe(&mut array, &borrowed, left, right); + Sequence::::append_recursive_safe(&mut array, &None, left, right); let result = Rc::new(array); - 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!() }; #[cfg(not(feature = "sync"))] - let mut guard = boxed.borrow_mut(); + { + *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 } @@ -860,19 +872,28 @@ where pub fn append_recursive_safe( array: &mut Vec, - borrowed: &Option<&Rc>>, - left: &Rc>>, - right: &Rc>>, + cache_borrow: &Option<&Rc>>, + left: &Rc>>, + right: &Rc>>, ) { - if let Some(values) = borrowed.as_ref() { + if let Some(values) = cache_borrow.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() }); + #[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) { @@ -885,7 +906,7 @@ where } } Sequence::ConcatSequence { - boxed, left, right, .. + cache: boxed, left, right, .. } => // Let's create an array of size length and fill it up recursively { @@ -904,20 +925,11 @@ where 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, .. } => @@ -1917,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() { @@ -2131,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; @@ -3237,7 +3231,6 @@ macro_rules! cast_any_object { }; } - // 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 @@ -3665,7 +3658,9 @@ pub struct AllocationTracker { } #[cfg(feature = "sync")] -pub fn allocate_object_track(allocation_tracker: &mut AllocationTracker) -> Object { +pub fn allocate_object_track( + allocation_tracker: &mut AllocationTracker, +) -> Object { let res = allocate_object::(); allocation_tracker .allocations 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 5397a3827..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,4002 +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; - #[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 - } - } + 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 7b252cce4..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,13 +87,16 @@ 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()); @@ -54,7 +108,7 @@ mod tests { 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(), @@ -317,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)); @@ -344,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 @@ -418,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); @@ -438,21 +495,26 @@ 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 { + impl Upcast for ClassWrapper { UpcastFn!(crate::DynAny); } - impl UpcastObject for ClassWrapper { + impl UpcastObject for ClassWrapper { UpcastObjectFn!(crate::DynAny); } @@ -467,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); @@ -477,7 +539,6 @@ mod tests { assert_eq!(Rc::strong_count(&x_copy.data), 1); } - #[test] #[allow(unused_unsafe)] fn test_class_wrapper_object() { @@ -490,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); } @@ -558,16 +619,27 @@ mod tests { let a: Ptr = Upcast::::upcast(read!(o)); assert_eq!(cast!(a, ClassWrapper), o); let seq_o = seq![o]; - let seq_a = Sequence::>>::coerce(upcast::, crate::DynAny>())(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::, crate::DynAny>())(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::, crate::DynAny>())(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::, crate::DynAny>())(map_o); + let map_a = Map::>>::coerce(upcast::< + ClassWrapper, + crate::DynAny, + >())(map_o); assert_eq!(cast!(map_a.get(&1), ClassWrapper), o); deallocate(o); } @@ -600,7 +672,10 @@ 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]; } @@ -692,20 +767,19 @@ 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| { - #[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; - } - }); + 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")] @@ -766,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, @@ -828,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); @@ -852,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()); } @@ -868,8 +944,18 @@ mod tests { } } impl NodeRcMutTrait for NodeRawMut {} - UpcastDefObject!(NodeRawMut, dyn NodeRcMutTrait, dyn SuperTrait, crate::DynAny); - UpcastDef!(NodeRawMut, dyn NodeRcMutTrait, dyn SuperTrait, crate::DynAny); + UpcastDefObject!( + NodeRawMut, + dyn NodeRcMutTrait, + dyn SuperTrait, + crate::DynAny + ); + UpcastDef!( + NodeRawMut, + dyn NodeRcMutTrait, + dyn SuperTrait, + crate::DynAny + ); impl SuperTrait for NodeRawMut {} @@ -914,11 +1000,9 @@ 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 { @@ -929,7 +1013,9 @@ mod tests { #[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 x = cast_object!(n, InternalOpaqueError); @@ -941,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); } @@ -954,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") } @@ -985,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 @@ -995,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() } @@ -1024,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()); @@ -1060,6 +1149,4 @@ mod tests { Box::new(self.as_ref().clone()) } }*/ - - } From df40ab552d21c09a4e3aa9a0503a3fa508edc7aa Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Tue, 28 Jan 2025 12:26:21 -0500 Subject: [PATCH 19/30] m --- TestVectors/runtimes/rust/Cargo.toml | 2 +- TestVectors/runtimes/rust/src/create_client.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TestVectors/runtimes/rust/Cargo.toml b/TestVectors/runtimes/rust/Cargo.toml index afd62c908..676187bb4 100644 --- a/TestVectors/runtimes/rust/Cargo.toml +++ b/TestVectors/runtimes/rust/Cargo.toml @@ -16,7 +16,7 @@ aws-smithy-runtime-api = {version = "1.7.3", features = ["client"] } aws-smithy-types = "1.2.10" chrono = "0.4.39" cpu-time = "1.0.0" -dafny_runtime = { path = "../../../submodules/MaterialProviders/smithy-dafny/TestModels/dafny-dependencies/dafny_runtime_rust", features = ["sync"]} +dafny-runtime = { path = "../../../releases/rust/db_esdk/dafny_runtime_rust", features = ["sync"] } dashmap = "6.1.0" pem = "3.0.4" tokio = {version = "1.42.0", features = ["full"] } 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, }) } From 1db8039a42f0a5ab27f959b8c6352d1f3c16e9bd Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Tue, 28 Jan 2025 13:43:31 -0500 Subject: [PATCH 20/30] m --- .github/workflows/library_rust_tests.yml | 2 +- submodules/MaterialProviders | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/library_rust_tests.yml b/.github/workflows/library_rust_tests.yml index 3915f800e..bf75bb451 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: | diff --git a/submodules/MaterialProviders b/submodules/MaterialProviders index 138558c10..f5b42dbd6 160000 --- a/submodules/MaterialProviders +++ b/submodules/MaterialProviders @@ -1 +1 @@ -Subproject commit 138558c10d577d1f7b789851e572dc09df99597a +Subproject commit f5b42dbd6bb1842dedc2fa761992c2293ccb7628 From f039dd0f074b02c21a21fb669305ce65c815afbd Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Tue, 28 Jan 2025 15:43:35 -0500 Subject: [PATCH 21/30] m --- DynamoDbEncryption/runtimes/rust/Cargo.toml | 16 ++++++++-------- .../runtimes/rust/test_examples/Cargo.toml | 18 +++++++++--------- .../runtimes/rust/upgrade_examples.sh | 7 +++++++ TestVectors/runtimes/rust/Cargo.toml | 16 ++++++++-------- submodules/MaterialProviders | 2 +- 5 files changed, 33 insertions(+), 26 deletions(-) create mode 100755 DynamoDbEncryption/runtimes/rust/upgrade_examples.sh diff --git a/DynamoDbEncryption/runtimes/rust/Cargo.toml b/DynamoDbEncryption/runtimes/rust/Cargo.toml index 83f05aca9..70e51fdb2 100644 --- a/DynamoDbEncryption/runtimes/rust/Cargo.toml +++ b/DynamoDbEncryption/runtimes/rust/Cargo.toml @@ -16,21 +16,21 @@ 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 = "../../../releases/rust/db_esdk/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/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 676187bb4..a633cd7ce 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 = "../../../releases/rust/db_esdk/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/submodules/MaterialProviders b/submodules/MaterialProviders index f5b42dbd6..8d0548232 160000 --- a/submodules/MaterialProviders +++ b/submodules/MaterialProviders @@ -1 +1 @@ -Subproject commit f5b42dbd6bb1842dedc2fa761992c2293ccb7628 +Subproject commit 8d0548232650f3ba4a7ffca1cb74e7f20552e868 From cfb378e9ce16ea4b60d2228a01211f0799f3dcff Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Fri, 31 Jan 2025 09:21:13 -0500 Subject: [PATCH 22/30] m --- .github/workflows/library_rust_tests.yml | 23 ++++++----------------- submodules/MaterialProviders | 2 +- submodules/smithy-dafny | 2 +- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/.github/workflows/library_rust_tests.yml b/.github/workflows/library_rust_tests.yml index bf75bb451..997075fd9 100644 --- a/.github/workflows/library_rust_tests.yml +++ b/.github/workflows/library_rust_tests.yml @@ -55,16 +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 - # Use setup-dafny-actions with correct version when Dafny releases 4.8.2 - name: Setup Dafny - uses: ./submodules/smithy-dafny/.github/actions/build_dafny_from_source + uses: dafny-lang/setup-dafny-action@v1.8.0 with: - dafny-version: 4.9.2 - ref: a928ebf5733dca040cbbb9b0c5861c20fb5bff6d + dafny-version: nightly-2025-01-30-7db1e5f - name: Update MPL submodule if using MPL HEAD if: ${{ inputs.mpl-head == true }} @@ -75,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: @@ -112,6 +97,10 @@ jobs: CORES=$(node -e 'console.log(os.cpus().length)') make transpile_rust TRANSPILE_TESTS_IN_RUST=1 CORES=$CORES + - name: Rustfmt Check + uses: actions-rust-lang/rustfmt@v1 + working-directory: ./${{ matrix.library }}/runtimes/rust + - name: Copy ${{ matrix.library }} Vector Files if: ${{ matrix.library == 'TestVectors' }} shell: bash diff --git a/submodules/MaterialProviders b/submodules/MaterialProviders index 8d0548232..533d5181a 160000 --- a/submodules/MaterialProviders +++ b/submodules/MaterialProviders @@ -1 +1 @@ -Subproject commit 8d0548232650f3ba4a7ffca1cb74e7f20552e868 +Subproject commit 533d5181a71937380da5370d7100715bf0339bcd diff --git a/submodules/smithy-dafny b/submodules/smithy-dafny index 506fad167..23f4838a8 160000 --- a/submodules/smithy-dafny +++ b/submodules/smithy-dafny @@ -1 +1 @@ -Subproject commit 506fad167333044ffb0dc51ca24e3967ebf8a290 +Subproject commit 23f4838a870d51a8761da2a462314ec75bf0ad79 From 042975140f1604c17bcef4d216c4b4cc4e890c67 Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Fri, 31 Jan 2025 10:23:41 -0500 Subject: [PATCH 23/30] m --- releases/rust/db_esdk/dafny_runtime_rust/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releases/rust/db_esdk/dafny_runtime_rust/Cargo.toml b/releases/rust/db_esdk/dafny_runtime_rust/Cargo.toml index 579ecb912..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)" From 645310147556692338c210afd8e12eecf84a1381 Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Fri, 31 Jan 2025 10:51:29 -0500 Subject: [PATCH 24/30] m --- .github/workflows/library_rust_tests.yml | 4 ---- submodules/MaterialProviders | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/library_rust_tests.yml b/.github/workflows/library_rust_tests.yml index 997075fd9..ddd6566ed 100644 --- a/.github/workflows/library_rust_tests.yml +++ b/.github/workflows/library_rust_tests.yml @@ -97,10 +97,6 @@ jobs: CORES=$(node -e 'console.log(os.cpus().length)') make transpile_rust TRANSPILE_TESTS_IN_RUST=1 CORES=$CORES - - name: Rustfmt Check - uses: actions-rust-lang/rustfmt@v1 - working-directory: ./${{ matrix.library }}/runtimes/rust - - name: Copy ${{ matrix.library }} Vector Files if: ${{ matrix.library == 'TestVectors' }} shell: bash diff --git a/submodules/MaterialProviders b/submodules/MaterialProviders index 533d5181a..fded3a744 160000 --- a/submodules/MaterialProviders +++ b/submodules/MaterialProviders @@ -1 +1 @@ -Subproject commit 533d5181a71937380da5370d7100715bf0339bcd +Subproject commit fded3a744a88cb6ce0c9bcd52b8b26ee8f18a87c From eafd0fc894a0cae445dafc3d091ada2efc0e3e5a Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Fri, 31 Jan 2025 11:37:37 -0500 Subject: [PATCH 25/30] m --- DynamoDbEncryption/runtimes/rust/RELEASE.md | 1 - .../runtimes/rust/start_release.sh | 26 +++++++++++++++++-- submodules/MaterialProviders | 2 +- submodules/smithy-dafny | 2 +- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/DynamoDbEncryption/runtimes/rust/RELEASE.md b/DynamoDbEncryption/runtimes/rust/RELEASE.md index ae5932b2b..a3539a549 100644 --- a/DynamoDbEncryption/runtimes/rust/RELEASE.md +++ b/DynamoDbEncryption/runtimes/rust/RELEASE.md @@ -1,6 +1,5 @@ To publish a new version of the aws-db-esdk for version N.N.N -1. Acquire the appropriate permissions 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/start_release.sh b/DynamoDbEncryption/runtimes/rust/start_release.sh index 7a0d88ca3..c5bbedd9a 100755 --- a/DynamoDbEncryption/runtimes/rust/start_release.sh +++ b/DynamoDbEncryption/runtimes/rust/start_release.sh @@ -17,6 +17,19 @@ if [ $MATCHES -eq 0 ]; then exit 1 fi +# assume role to allow tests to run +mwinit -f +unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN AWS_PROFILE +_assume_role="arn:aws:iam::370957321024:role/GitHub-CI-DDBEC-Dafny-Role-us-west-2" +_session_name="${USER}-DDBEC-Dafny-Java-Tests" +export AWS_PROFILE=aws-crypto-tools-team+optools-ci-ToolsDevelopment +export AWS_REGION=us-west-2 +STS_RESPONSE=`aws sts assume-role --role-arn $_assume_role --role-session-name $_session_name` +export AWS_ACCESS_KEY_ID=`echo "$STS_RESPONSE" | jq -r .Credentials.AccessKeyId` +export AWS_SECRET_ACCESS_KEY=`echo "$STS_RESPONSE" | jq -r .Credentials.SecretAccessKey` +export AWS_SESSION_TOKEN=`echo "$STS_RESPONSE" | jq -r .Credentials.SessionToken` +unset AWS_PROFILE AWS_SDK_LOAD_CONFIG _assume_role _session_name STS_RESPONSE + # Update the version in Cargo.toml perl -pe "s/^version = .*$/version = \"$1\"/" < Cargo.toml > new_Cargo.toml mv new_Cargo.toml Cargo.toml @@ -26,7 +39,7 @@ find src -depth 1 | egrep -v '(intercept.rs|lib.rs|software_externs.rs|README)' # 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 +56,22 @@ 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 + +# 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/submodules/MaterialProviders b/submodules/MaterialProviders index fded3a744..b301c6a28 160000 --- a/submodules/MaterialProviders +++ b/submodules/MaterialProviders @@ -1 +1 @@ -Subproject commit fded3a744a88cb6ce0c9bcd52b8b26ee8f18a87c +Subproject commit b301c6a28a7c4f22bd70a41be8b57fad0bfaf4af diff --git a/submodules/smithy-dafny b/submodules/smithy-dafny index 23f4838a8..5fb3f25ea 160000 --- a/submodules/smithy-dafny +++ b/submodules/smithy-dafny @@ -1 +1 @@ -Subproject commit 23f4838a870d51a8761da2a462314ec75bf0ad79 +Subproject commit 5fb3f25ea3444c51b2ad30b25ab03964cf866cd1 From 487f7fcd81f6ea0d369a162da649fb796649dfe5 Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Fri, 31 Jan 2025 13:20:10 -0500 Subject: [PATCH 26/30] m --- .../runtimes/rust/start_release.sh | 16 +++++++++++++++- submodules/MaterialProviders | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/DynamoDbEncryption/runtimes/rust/start_release.sh b/DynamoDbEncryption/runtimes/rust/start_release.sh index c5bbedd9a..e4ffcac4a 100755 --- a/DynamoDbEncryption/runtimes/rust/start_release.sh +++ b/DynamoDbEncryption/runtimes/rust/start_release.sh @@ -29,11 +29,21 @@ export AWS_ACCESS_KEY_ID=`echo "$STS_RESPONSE" | jq -r .Credentials.AccessKeyId` export AWS_SECRET_ACCESS_KEY=`echo "$STS_RESPONSE" | jq -r .Credentials.SecretAccessKey` export AWS_SESSION_TOKEN=`echo "$STS_RESPONSE" | jq -r .Credentials.SessionToken` unset AWS_PROFILE AWS_SDK_LOAD_CONFIG _assume_role _session_name STS_RESPONSE - + +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 @@ -65,6 +75,10 @@ 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 diff --git a/submodules/MaterialProviders b/submodules/MaterialProviders index b301c6a28..5808fbfd1 160000 --- a/submodules/MaterialProviders +++ b/submodules/MaterialProviders @@ -1 +1 @@ -Subproject commit b301c6a28a7c4f22bd70a41be8b57fad0bfaf4af +Subproject commit 5808fbfd13ed12eb258883010626e1ae75708089 From d71314941a90a503c35024a0135211df5257c49f Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Fri, 31 Jan 2025 15:23:00 -0500 Subject: [PATCH 27/30] m --- DynamoDbEncryption/runtimes/rust/RELEASE.md | 1 + DynamoDbEncryption/runtimes/rust/start_release.sh | 13 ------------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/DynamoDbEncryption/runtimes/rust/RELEASE.md b/DynamoDbEncryption/runtimes/rust/RELEASE.md index a3539a549..77baff19b 100644 --- a/DynamoDbEncryption/runtimes/rust/RELEASE.md +++ b/DynamoDbEncryption/runtimes/rust/RELEASE.md @@ -1,5 +1,6 @@ To publish a new version of the aws-db-esdk for version N.N.N +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/start_release.sh b/DynamoDbEncryption/runtimes/rust/start_release.sh index e4ffcac4a..2baa8a33b 100755 --- a/DynamoDbEncryption/runtimes/rust/start_release.sh +++ b/DynamoDbEncryption/runtimes/rust/start_release.sh @@ -17,19 +17,6 @@ if [ $MATCHES -eq 0 ]; then exit 1 fi -# assume role to allow tests to run -mwinit -f -unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN AWS_PROFILE -_assume_role="arn:aws:iam::370957321024:role/GitHub-CI-DDBEC-Dafny-Role-us-west-2" -_session_name="${USER}-DDBEC-Dafny-Java-Tests" -export AWS_PROFILE=aws-crypto-tools-team+optools-ci-ToolsDevelopment -export AWS_REGION=us-west-2 -STS_RESPONSE=`aws sts assume-role --role-arn $_assume_role --role-session-name $_session_name` -export AWS_ACCESS_KEY_ID=`echo "$STS_RESPONSE" | jq -r .Credentials.AccessKeyId` -export AWS_SECRET_ACCESS_KEY=`echo "$STS_RESPONSE" | jq -r .Credentials.SecretAccessKey` -export AWS_SESSION_TOKEN=`echo "$STS_RESPONSE" | jq -r .Credentials.SessionToken` -unset AWS_PROFILE AWS_SDK_LOAD_CONFIG _assume_role _session_name STS_RESPONSE - echo echo echo "Current Dafny Version:" From ada8fcae6a2c32b3b0b4e65c172f8a6c04ea1edc Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Fri, 31 Jan 2025 15:25:38 -0500 Subject: [PATCH 28/30] m --- .github/workflows/library_rust_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/library_rust_tests.yml b/.github/workflows/library_rust_tests.yml index ddd6566ed..59c96fc37 100644 --- a/.github/workflows/library_rust_tests.yml +++ b/.github/workflows/library_rust_tests.yml @@ -108,7 +108,7 @@ jobs: shell: bash working-directory: ./${{ matrix.library }} run: | - make test_rust + make test_rust test_rust_debug - name: Test Examples for Rust in ${{ matrix.library }} if: ${{ matrix.library == 'DynamoDbEncryption' }} From 519d42b9ce8d8790a0f087069658b4dda0493e5f Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Fri, 31 Jan 2025 16:00:20 -0500 Subject: [PATCH 29/30] m --- DynamoDbEncryption/runtimes/rust/Cargo.toml | 3 +-- DynamoDbEncryption/runtimes/rust/start_release.sh | 2 +- TestVectors/runtimes/rust/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/DynamoDbEncryption/runtimes/rust/Cargo.toml b/DynamoDbEncryption/runtimes/rust/Cargo.toml index 70e51fdb2..9c2f41341 100644 --- a/DynamoDbEncryption/runtimes/rust/Cargo.toml +++ b/DynamoDbEncryption/runtimes/rust/Cargo.toml @@ -25,8 +25,7 @@ aws-smithy-runtime-api = {version = "1.7.3", features = ["client"] } aws-smithy-types = "1.2.12" chrono = "0.4.39" cpu-time = "1.0.0" -#dafny-runtime = "0.1.1" -dafny-runtime = { path = "../../../releases/rust/db_esdk/dafny_runtime_rust", features = ["sync"] } +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.43.0", features = ["full"] } diff --git a/DynamoDbEncryption/runtimes/rust/start_release.sh b/DynamoDbEncryption/runtimes/rust/start_release.sh index 2baa8a33b..921fbd36c 100755 --- a/DynamoDbEncryption/runtimes/rust/start_release.sh +++ b/DynamoDbEncryption/runtimes/rust/start_release.sh @@ -67,7 +67,7 @@ cargo clippy cargo clippy --example main # replace local path with latest dafny-runtime from crates.io -cargo rm dafny-runtime +cargo rm dafny_runtime cargo add dafny-runtime -F sync # Run cargo test and example tests diff --git a/TestVectors/runtimes/rust/Cargo.toml b/TestVectors/runtimes/rust/Cargo.toml index a633cd7ce..3b632b1d7 100644 --- a/TestVectors/runtimes/rust/Cargo.toml +++ b/TestVectors/runtimes/rust/Cargo.toml @@ -16,7 +16,7 @@ aws-smithy-runtime-api = {version = "1.7.3", features = ["client"] } aws-smithy-types = "1.2.12" chrono = "0.4.39" cpu-time = "1.0.0" -dafny-runtime = { path = "../../../releases/rust/db_esdk/dafny_runtime_rust", features = ["sync"] } +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.43.0", features = ["full"] } From 20c2f17dfb07ba85828c7c9fe76ae234824c5066 Mon Sep 17 00:00:00 2001 From: Andy Jewell Date: Fri, 31 Jan 2025 18:02:09 -0500 Subject: [PATCH 30/30] m --- .github/workflows/library_rust_tests.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/library_rust_tests.yml b/.github/workflows/library_rust_tests.yml index 59c96fc37..fdc8237cf 100644 --- a/.github/workflows/library_rust_tests.yml +++ b/.github/workflows/library_rust_tests.yml @@ -105,6 +105,13 @@ jobs: cp runtimes/java/*.json runtimes/rust/ - name: Test ${{ matrix.library }} Rust + shell: bash + working-directory: ./${{ matrix.library }} + run: | + make test_rust + + - name: Test ${{ matrix.library }} Rust Debug + if: ${{ matrix.library != 'TestVectors' }} shell: bash working-directory: ./${{ matrix.library }} run: |