From 39e3291216c2108cd51f3eb08668544aa214ce11 Mon Sep 17 00:00:00 2001 From: "Mayeul@Zama" <69792125+mayeul-zama@users.noreply.github.com> Date: Thu, 3 Oct 2024 15:04:28 +0200 Subject: [PATCH] chore(all): format --- tfhe-zk-pok/src/curve_api/msm.rs | 2 +- tfhe-zk-pok/src/proofs/mod.rs | 6 +- tfhe-zk-pok/src/proofs/pke.rs | 10 +- tfhe-zk-pok/src/proofs/pke_v2.rs | 10 +- .../core_crypto/entities/ggsw_ciphertext.rs | 12 +- .../entities/ggsw_ciphertext_list.rs | 12 +- .../entities/glwe_ciphertext_list.rs | 12 +- .../core_crypto/entities/lwe_ciphertext.rs | 24 ++-- .../entities/lwe_ciphertext_list.rs | 12 +- .../core_crypto/entities/lwe_keyswitch_key.rs | 12 +- .../entities/lwe_multi_bit_bootstrap_key.rs | 5 +- .../entities/lwe_packing_keyswitch_key.rs | 12 +- ...rivate_functional_packing_keyswitch_key.rs | 12 +- ...e_functional_packing_keyswitch_key_list.rs | 12 +- .../core_crypto/entities/plaintext_list.rs | 12 +- .../core_crypto/entities/polynomial_list.rs | 12 +- .../entities/seeded_ggsw_ciphertext.rs | 12 +- .../entities/seeded_ggsw_ciphertext_list.rs | 12 +- .../entities/seeded_glwe_ciphertext_list.rs | 12 +- .../entities/seeded_lwe_ciphertext_list.rs | 12 +- .../entities/seeded_lwe_keyswitch_key.rs | 12 +- .../seeded_lwe_packing_keyswitch_key.rs | 12 +- .../entities/pseudo_ggsw_ciphertext.rs | 12 +- .../fft_impl/fft64/crypto/bootstrap.rs | 5 +- .../core_crypto/fft_impl/fft64/crypto/ggsw.rs | 5 +- .../fft_impl/fft64/math/fft/mod.rs | 5 +- tfhe/src/high_level_api/array/cpu/booleans.rs | 10 +- tfhe/src/high_level_api/array/cpu/integers.rs | 6 +- tfhe/src/high_level_api/array/cpu/mod.rs | 10 +- .../high_level_api/array/dynamic/booleans.rs | 10 +- .../high_level_api/array/dynamic/signed.rs | 10 +- tfhe/src/high_level_api/array/mod.rs | 6 +- tfhe/src/high_level_api/tag.rs | 3 +- tfhe/src/integer/server_key/comparator.rs | 6 +- tfhe/src/shortint/parameters/mod.rs | 2 +- tfhe/src/shortint/server_key/mod.rs | 5 +- .../tfhe-versionable/examples/manual_impl.rs | 3 +- utils/tfhe-versionable/src/lib.rs | 130 ++++++++++++++---- 38 files changed, 342 insertions(+), 135 deletions(-) diff --git a/tfhe-zk-pok/src/curve_api/msm.rs b/tfhe-zk-pok/src/curve_api/msm.rs index acb5d1d124..690da686c2 100644 --- a/tfhe-zk-pok/src/curve_api/msm.rs +++ b/tfhe-zk-pok/src/curve_api/msm.rs @@ -14,7 +14,7 @@ fn make_digits(a: &impl BigInteger, w: usize, num_bits: usize) -> impl Iterator< } else { num_bits }; - let digits_count = num_bits.div_ceil(w) ; + let digits_count = num_bits.div_ceil(w); (0..digits_count).map(move |i| { // Construct a buffer of bits of the scalar, starting at `bit_offset`. diff --git a/tfhe-zk-pok/src/proofs/mod.rs b/tfhe-zk-pok/src/proofs/mod.rs index 2976ab1feb..75e3f70eaa 100644 --- a/tfhe-zk-pok/src/proofs/mod.rs +++ b/tfhe-zk-pok/src/proofs/mod.rs @@ -14,10 +14,10 @@ pub(crate) struct OneBased(T); // TODO: these impl could be removed by adding support for `repr(transparent)` in tfhe-versionable impl Versionize for OneBased { - type Versioned<'vers> = T::Versioned<'vers> + type Versioned<'vers> + = T::Versioned<'vers> where - T: 'vers, - ; + T: 'vers; fn versionize(&self) -> Self::Versioned<'_> { self.0.versionize() diff --git a/tfhe-zk-pok/src/proofs/pke.rs b/tfhe-zk-pok/src/proofs/pke.rs index fbfa59ce12..03b4e3696c 100644 --- a/tfhe-zk-pok/src/proofs/pke.rs +++ b/tfhe-zk-pok/src/proofs/pke.rs @@ -55,10 +55,12 @@ where SerializablePKEv1PublicParamsVersions: VersionsDispatch, GroupElements: Into, { - type Versioned<'vers> = - >::Owned where G:'vers; + type Versioned<'vers> + = >::Owned + where + G: 'vers; fn versionize(&self) -> Self::Versioned<'_> { VersionizeOwned::versionize_owned(SerializablePKEv1PublicParams::from(self.to_owned())) } diff --git a/tfhe-zk-pok/src/proofs/pke_v2.rs b/tfhe-zk-pok/src/proofs/pke_v2.rs index b9312a0a9f..1a4c2d355e 100644 --- a/tfhe-zk-pok/src/proofs/pke_v2.rs +++ b/tfhe-zk-pok/src/proofs/pke_v2.rs @@ -62,10 +62,12 @@ where SerializablePKEv2PublicParamsVersions: VersionsDispatch, GroupElements: Into, { - type Versioned<'vers> = - >::Owned where G:'vers; + type Versioned<'vers> + = >::Owned + where + G: 'vers; fn versionize(&self) -> Self::Versioned<'_> { VersionizeOwned::versionize_owned(SerializablePKEv2PublicParams::from(self.to_owned())) } diff --git a/tfhe/src/core_crypto/entities/ggsw_ciphertext.rs b/tfhe/src/core_crypto/entities/ggsw_ciphertext.rs index 028afb53fe..6b92b1909e 100644 --- a/tfhe/src/core_crypto/entities/ggsw_ciphertext.rs +++ b/tfhe/src/core_crypto/entities/ggsw_ciphertext.rs @@ -780,13 +780,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = GgswLevelMatrixCreationMetadata; - type EntityView<'this> = GgswLevelMatrix<&'this [Self::Element]> + type EntityView<'this> + = GgswLevelMatrix<&'this [Self::Element]> where Self: 'this; type SelfViewMetadata = (); - type SelfView<'this> = DummyCreateFrom + type SelfView<'this> + = DummyCreateFrom where Self: 'this; @@ -815,11 +817,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for GgswCiphertext { - type EntityMutView<'this> = GgswLevelMatrix<&'this mut [Self::Element]> + type EntityMutView<'this> + = GgswLevelMatrix<&'this mut [Self::Element]> where Self: 'this; - type SelfMutView<'this> = DummyCreateFrom + type SelfMutView<'this> + = DummyCreateFrom where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/ggsw_ciphertext_list.rs b/tfhe/src/core_crypto/entities/ggsw_ciphertext_list.rs index fd79b6eda3..87e32b63b8 100644 --- a/tfhe/src/core_crypto/entities/ggsw_ciphertext_list.rs +++ b/tfhe/src/core_crypto/entities/ggsw_ciphertext_list.rs @@ -359,13 +359,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = GgswCiphertextCreationMetadata; - type EntityView<'this> = GgswCiphertextView<'this, Self::Element> + type EntityView<'this> + = GgswCiphertextView<'this, Self::Element> where Self: 'this; type SelfViewMetadata = GgswCiphertextListCreationMetadata; - type SelfView<'this> = GgswCiphertextListView<'this, Self::Element> + type SelfView<'this> + = GgswCiphertextListView<'this, Self::Element> where Self: 'this; @@ -400,11 +402,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for GgswCiphertextList { - type EntityMutView<'this> = GgswCiphertextMutView<'this, Self::Element> + type EntityMutView<'this> + = GgswCiphertextMutView<'this, Self::Element> where Self: 'this; - type SelfMutView<'this> = GgswCiphertextListMutView<'this, Self::Element> + type SelfMutView<'this> + = GgswCiphertextListMutView<'this, Self::Element> where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/glwe_ciphertext_list.rs b/tfhe/src/core_crypto/entities/glwe_ciphertext_list.rs index 040291effe..5229009099 100644 --- a/tfhe/src/core_crypto/entities/glwe_ciphertext_list.rs +++ b/tfhe/src/core_crypto/entities/glwe_ciphertext_list.rs @@ -262,13 +262,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = GlweCiphertextCreationMetadata; - type EntityView<'this> = GlweCiphertextView<'this, Self::Element> + type EntityView<'this> + = GlweCiphertextView<'this, Self::Element> where Self: 'this; type SelfViewMetadata = GlweCiphertextListCreationMetadata; - type SelfView<'this> = GlweCiphertextListView<'this, Self::Element> + type SelfView<'this> + = GlweCiphertextListView<'this, Self::Element> where Self: 'this; @@ -295,11 +297,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for GlweCiphertextList { - type EntityMutView<'this> = GlweCiphertextMutView<'this, Self::Element> + type EntityMutView<'this> + = GlweCiphertextMutView<'this, Self::Element> where Self: 'this; - type SelfMutView<'this> = GlweCiphertextListMutView<'this, Self::Element> + type SelfMutView<'this> + = GlweCiphertextListMutView<'this, Self::Element> where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/lwe_ciphertext.rs b/tfhe/src/core_crypto/entities/lwe_ciphertext.rs index fdabadeb60..1592c4001a 100644 --- a/tfhe/src/core_crypto/entities/lwe_ciphertext.rs +++ b/tfhe/src/core_crypto/entities/lwe_ciphertext.rs @@ -178,13 +178,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = LweBodyCreationMetadata; - type EntityView<'this> = LweBodyRef<'this, Self::Element> + type EntityView<'this> + = LweBodyRef<'this, Self::Element> where Self: 'this; type SelfViewMetadata = LweBodyListCreationMetadata; - type SelfView<'this> = LweBodyListView<'this,Self::Element> + type SelfView<'this> + = LweBodyListView<'this, Self::Element> where Self: 'this; @@ -208,11 +210,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for LweBodyList { - type EntityMutView<'this> = LweBodyRefMut<'this, Self::Element> + type EntityMutView<'this> + = LweBodyRefMut<'this, Self::Element> where Self: 'this; - type SelfMutView<'this> = LweBodyListMutView<'this, Self::Element> + type SelfMutView<'this> + = LweBodyListMutView<'this, Self::Element> where Self: 'this; } @@ -429,13 +433,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = LweMaskCreationMetadata; - type EntityView<'this> = LweMask<&'this [Self::Element]> + type EntityView<'this> + = LweMask<&'this [Self::Element]> where Self: 'this; type SelfViewMetadata = LweMaskListCreationMetadata; - type SelfView<'this> = LweMaskListView<'this, Self::Element> + type SelfView<'this> + = LweMaskListView<'this, Self::Element> where Self: 'this; @@ -460,11 +466,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for LweMaskList { - type EntityMutView<'this> = LweMask<&'this mut [Self::Element]> + type EntityMutView<'this> + = LweMask<&'this mut [Self::Element]> where Self: 'this; - type SelfMutView<'this> = LweMaskListMutView<'this,Self::Element> + type SelfMutView<'this> + = LweMaskListMutView<'this, Self::Element> where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/lwe_ciphertext_list.rs b/tfhe/src/core_crypto/entities/lwe_ciphertext_list.rs index c106b05080..a813763f36 100644 --- a/tfhe/src/core_crypto/entities/lwe_ciphertext_list.rs +++ b/tfhe/src/core_crypto/entities/lwe_ciphertext_list.rs @@ -315,13 +315,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = LweCiphertextCreationMetadata; - type EntityView<'this> = LweCiphertextView<'this, Self::Element> + type EntityView<'this> + = LweCiphertextView<'this, Self::Element> where Self: 'this; type SelfViewMetadata = LweCiphertextListCreationMetadata; - type SelfView<'this> = LweCiphertextListView<'this, Self::Element> + type SelfView<'this> + = LweCiphertextListView<'this, Self::Element> where Self: 'this; @@ -346,11 +348,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for LweCiphertextList { - type EntityMutView<'this> = LweCiphertextMutView<'this, Self::Element> + type EntityMutView<'this> + = LweCiphertextMutView<'this, Self::Element> where Self: 'this; - type SelfMutView<'this> = LweCiphertextListMutView<'this, Self::Element> + type SelfMutView<'this> + = LweCiphertextListMutView<'this, Self::Element> where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/lwe_keyswitch_key.rs b/tfhe/src/core_crypto/entities/lwe_keyswitch_key.rs index fdecdff44c..93e085802f 100644 --- a/tfhe/src/core_crypto/entities/lwe_keyswitch_key.rs +++ b/tfhe/src/core_crypto/entities/lwe_keyswitch_key.rs @@ -388,13 +388,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = LweCiphertextListCreationMetadata; - type EntityView<'this> = LweCiphertextListView<'this, Self::Element> + type EntityView<'this> + = LweCiphertextListView<'this, Self::Element> where Self: 'this; type SelfViewMetadata = LweKeyswitchKeyCreationMetadata; - type SelfView<'this> = LweKeyswitchKeyView<'this, Self::Element> + type SelfView<'this> + = LweKeyswitchKeyView<'this, Self::Element> where Self: 'this; @@ -422,11 +424,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for LweKeyswitchKey { - type EntityMutView<'this> = LweCiphertextListMutView<'this, Self::Element> + type EntityMutView<'this> + = LweCiphertextListMutView<'this, Self::Element> where Self: 'this; - type SelfMutView<'this> = LweKeyswitchKeyMutView<'this, Self::Element> + type SelfMutView<'this> + = LweKeyswitchKeyMutView<'this, Self::Element> where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/lwe_multi_bit_bootstrap_key.rs b/tfhe/src/core_crypto/entities/lwe_multi_bit_bootstrap_key.rs index 6ca8915191..fc72e69e82 100644 --- a/tfhe/src/core_crypto/entities/lwe_multi_bit_bootstrap_key.rs +++ b/tfhe/src/core_crypto/entities/lwe_multi_bit_bootstrap_key.rs @@ -476,7 +476,10 @@ impl> TryFrom> Versionize for FourierLweMultiBitBootstrapKey { - type Versioned<'vers> = FourierLweMultiBitBootstrapKeyVersioned<'vers> where C: 'vers; + type Versioned<'vers> + = FourierLweMultiBitBootstrapKeyVersioned<'vers> + where + C: 'vers; fn versionize(&self) -> Self::Versioned<'_> { self.into() diff --git a/tfhe/src/core_crypto/entities/lwe_packing_keyswitch_key.rs b/tfhe/src/core_crypto/entities/lwe_packing_keyswitch_key.rs index 91505f4d41..413b9f34bb 100644 --- a/tfhe/src/core_crypto/entities/lwe_packing_keyswitch_key.rs +++ b/tfhe/src/core_crypto/entities/lwe_packing_keyswitch_key.rs @@ -350,7 +350,8 @@ impl> ContiguousEntityCo type EntityViewMetadata = GlweCiphertextListCreationMetadata; - type EntityView<'this> = GlweCiphertextListView<'this, Self::Element> + type EntityView<'this> + = GlweCiphertextListView<'this, Self::Element> where Self: 'this; @@ -358,7 +359,8 @@ impl> ContiguousEntityCo // At the moment it does not make sense to return "sub" keyswitch keys. So we use a dummy // placeholder type here. - type SelfView<'this> = DummyCreateFrom + type SelfView<'this> + = DummyCreateFrom where Self: 'this; @@ -387,13 +389,15 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for LwePackingKeyswitchKey { - type EntityMutView<'this> = GlweCiphertextListMutView<'this, Self::Element> + type EntityMutView<'this> + = GlweCiphertextListMutView<'this, Self::Element> where Self: 'this; // At the moment it does not make sense to return "sub" keyswitch keys. So we use a dummy // placeholder type here. - type SelfMutView<'this> = DummyCreateFrom + type SelfMutView<'this> + = DummyCreateFrom where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/lwe_private_functional_packing_keyswitch_key.rs b/tfhe/src/core_crypto/entities/lwe_private_functional_packing_keyswitch_key.rs index 4af1bb91c4..2f6d1e516f 100644 --- a/tfhe/src/core_crypto/entities/lwe_private_functional_packing_keyswitch_key.rs +++ b/tfhe/src/core_crypto/entities/lwe_private_functional_packing_keyswitch_key.rs @@ -437,13 +437,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = GlweCiphertextListCreationMetadata; - type EntityView<'this> = GlweCiphertextListView<'this, Self::Element> + type EntityView<'this> + = GlweCiphertextListView<'this, Self::Element> where Self: 'this; type SelfViewMetadata = LwePrivateFunctionalPackingKeyswitchKeyCreationMetadata; - type SelfView<'this> = LwePrivateFunctionalPackingKeyswitchKeyView<'this, Self::Element> + type SelfView<'this> + = LwePrivateFunctionalPackingKeyswitchKeyView<'this, Self::Element> where Self: 'this; @@ -473,11 +475,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for LwePrivateFunctionalPackingKeyswitchKey { - type EntityMutView<'this> = GlweCiphertextListMutView<'this, Self::Element> + type EntityMutView<'this> + = GlweCiphertextListMutView<'this, Self::Element> where Self: 'this; - type SelfMutView<'this> = LwePrivateFunctionalPackingKeyswitchKeyMutView<'this, Self::Element> + type SelfMutView<'this> + = LwePrivateFunctionalPackingKeyswitchKeyMutView<'this, Self::Element> where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/lwe_private_functional_packing_keyswitch_key_list.rs b/tfhe/src/core_crypto/entities/lwe_private_functional_packing_keyswitch_key_list.rs index 31886fe3b2..e3d7ce0c4d 100644 --- a/tfhe/src/core_crypto/entities/lwe_private_functional_packing_keyswitch_key_list.rs +++ b/tfhe/src/core_crypto/entities/lwe_private_functional_packing_keyswitch_key_list.rs @@ -443,14 +443,16 @@ impl> ContiguousEntityCo type EntityViewMetadata = LwePrivateFunctionalPackingKeyswitchKeyCreationMetadata; - type EntityView<'this> = LwePrivateFunctionalPackingKeyswitchKey<&'this [Self::Element]> + type EntityView<'this> + = LwePrivateFunctionalPackingKeyswitchKey<&'this [Self::Element]> where Self: 'this; type SelfViewMetadata = LwePrivateFunctionalPackingKeyswitchKeyListCreationMetadata; - type SelfView<'this> = LwePrivateFunctionalPackingKeyswitchKeyList<&'this [Self::Element]> + type SelfView<'this> + = LwePrivateFunctionalPackingKeyswitchKeyList<&'this [Self::Element]> where Self: 'this; @@ -483,11 +485,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for LwePrivateFunctionalPackingKeyswitchKeyList { - type EntityMutView<'this> = LwePrivateFunctionalPackingKeyswitchKey<&'this mut [Self::Element]> + type EntityMutView<'this> + = LwePrivateFunctionalPackingKeyswitchKey<&'this mut [Self::Element]> where Self: 'this; - type SelfMutView<'this> = LwePrivateFunctionalPackingKeyswitchKeyList<&'this mut [Self::Element]> + type SelfMutView<'this> + = LwePrivateFunctionalPackingKeyswitchKeyList<&'this mut [Self::Element]> where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/plaintext_list.rs b/tfhe/src/core_crypto/entities/plaintext_list.rs index e3b631fefb..34f6fa6271 100644 --- a/tfhe/src/core_crypto/entities/plaintext_list.rs +++ b/tfhe/src/core_crypto/entities/plaintext_list.rs @@ -136,13 +136,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = (); - type EntityView<'this> = PlaintextRef<'this, Self::Element> + type EntityView<'this> + = PlaintextRef<'this, Self::Element> where Self: 'this; type SelfViewMetadata = (); - type SelfView<'this> = PlaintextList<&'this [Self::Element]> + type SelfView<'this> + = PlaintextList<&'this [Self::Element]> where Self: 'this; @@ -158,11 +160,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for PlaintextList { - type EntityMutView<'this>= PlaintextRefMut<'this, Self::Element> + type EntityMutView<'this> + = PlaintextRefMut<'this, Self::Element> where Self: 'this; - type SelfMutView<'this>= PlaintextList<&'this mut [Self::Element]> + type SelfMutView<'this> + = PlaintextList<&'this mut [Self::Element]> where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/polynomial_list.rs b/tfhe/src/core_crypto/entities/polynomial_list.rs index d6d71916c2..d5e8f4441d 100644 --- a/tfhe/src/core_crypto/entities/polynomial_list.rs +++ b/tfhe/src/core_crypto/entities/polynomial_list.rs @@ -160,13 +160,15 @@ impl ContiguousEntityContainer for PolynomialList { type EntityViewMetadata = PolynomialCreationMetadata; - type EntityView<'this> = PolynomialView<'this, Self::Element> + type EntityView<'this> + = PolynomialView<'this, Self::Element> where Self: 'this; type SelfViewMetadata = PolynomialListCreationMetadata; - type SelfView<'this> = PolynomialListView<'this, Self::Element> + type SelfView<'this> + = PolynomialListView<'this, Self::Element> where Self: 'this; @@ -186,11 +188,13 @@ impl ContiguousEntityContainer for PolynomialList { } impl ContiguousEntityContainerMut for PolynomialList { - type EntityMutView<'this> = PolynomialMutView<'this, Self::Element> + type EntityMutView<'this> + = PolynomialMutView<'this, Self::Element> where Self: 'this; - type SelfMutView<'this> = PolynomialListMutView<'this, Self::Element> + type SelfMutView<'this> + = PolynomialListMutView<'this, Self::Element> where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/seeded_ggsw_ciphertext.rs b/tfhe/src/core_crypto/entities/seeded_ggsw_ciphertext.rs index 206d5754dd..8b0572a657 100644 --- a/tfhe/src/core_crypto/entities/seeded_ggsw_ciphertext.rs +++ b/tfhe/src/core_crypto/entities/seeded_ggsw_ciphertext.rs @@ -686,13 +686,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = SeededGgswLevelMatrixCreationMetadata; - type EntityView<'this> = SeededGgswLevelMatrix<&'this [Self::Element]> + type EntityView<'this> + = SeededGgswLevelMatrix<&'this [Self::Element]> where Self: 'this; type SelfViewMetadata = (); - type SelfView<'this> = DummyCreateFrom + type SelfView<'this> + = DummyCreateFrom where Self: 'this; @@ -722,11 +724,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for SeededGgswCiphertext { - type EntityMutView<'this> = SeededGgswLevelMatrix<&'this mut [Self::Element]> + type EntityMutView<'this> + = SeededGgswLevelMatrix<&'this mut [Self::Element]> where Self: 'this; - type SelfMutView<'this> = DummyCreateFrom + type SelfMutView<'this> + = DummyCreateFrom where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/seeded_ggsw_ciphertext_list.rs b/tfhe/src/core_crypto/entities/seeded_ggsw_ciphertext_list.rs index b7dd2f8eef..7a74f4bb1c 100644 --- a/tfhe/src/core_crypto/entities/seeded_ggsw_ciphertext_list.rs +++ b/tfhe/src/core_crypto/entities/seeded_ggsw_ciphertext_list.rs @@ -414,13 +414,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = SeededGgswCiphertextCreationMetadata; - type EntityView<'this> = SeededGgswCiphertextView<'this, Self::Element> + type EntityView<'this> + = SeededGgswCiphertextView<'this, Self::Element> where Self: 'this; type SelfViewMetadata = SeededGgswCiphertextListCreationMetadata; - type SelfView<'this> = SeededGgswCiphertextListView<'this, Self::Element> + type SelfView<'this> + = SeededGgswCiphertextListView<'this, Self::Element> where Self: 'this; @@ -459,11 +461,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for SeededGgswCiphertextList { - type EntityMutView<'this> = SeededGgswCiphertextMutView<'this, Self::Element> + type EntityMutView<'this> + = SeededGgswCiphertextMutView<'this, Self::Element> where Self: 'this; - type SelfMutView<'this> = SeededGgswCiphertextListMutView<'this, Self::Element> + type SelfMutView<'this> + = SeededGgswCiphertextListMutView<'this, Self::Element> where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/seeded_glwe_ciphertext_list.rs b/tfhe/src/core_crypto/entities/seeded_glwe_ciphertext_list.rs index 99b227eb02..b925b57000 100644 --- a/tfhe/src/core_crypto/entities/seeded_glwe_ciphertext_list.rs +++ b/tfhe/src/core_crypto/entities/seeded_glwe_ciphertext_list.rs @@ -302,13 +302,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = SeededGlweCiphertextCreationMetadata; - type EntityView<'this> = SeededGlweCiphertext<&'this [Self::Element]> + type EntityView<'this> + = SeededGlweCiphertext<&'this [Self::Element]> where Self: 'this; type SelfViewMetadata = (); - type SelfView<'this> = DummyCreateFrom + type SelfView<'this> + = DummyCreateFrom where Self: 'this; @@ -337,11 +339,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for SeededGlweCiphertextList { - type EntityMutView<'this> = SeededGlweCiphertext<&'this mut [Self::Element]> + type EntityMutView<'this> + = SeededGlweCiphertext<&'this mut [Self::Element]> where Self: 'this; - type SelfMutView<'this> = DummyCreateFrom + type SelfMutView<'this> + = DummyCreateFrom where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/seeded_lwe_ciphertext_list.rs b/tfhe/src/core_crypto/entities/seeded_lwe_ciphertext_list.rs index 90518576fc..4b474b32d4 100644 --- a/tfhe/src/core_crypto/entities/seeded_lwe_ciphertext_list.rs +++ b/tfhe/src/core_crypto/entities/seeded_lwe_ciphertext_list.rs @@ -332,13 +332,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = LweBodyCreationMetadata; - type EntityView<'this> = LweBodyRef<'this, Self::Element> + type EntityView<'this> + = LweBodyRef<'this, Self::Element> where Self: 'this; type SelfViewMetadata = (); - type SelfView<'this> = DummyCreateFrom + type SelfView<'this> + = DummyCreateFrom where Self: 'this; @@ -365,11 +367,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for SeededLweCiphertextList { - type EntityMutView<'this> = LweBodyRefMut<'this, Self::Element> + type EntityMutView<'this> + = LweBodyRefMut<'this, Self::Element> where Self: 'this; - type SelfMutView<'this> = DummyCreateFrom + type SelfMutView<'this> + = DummyCreateFrom where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/seeded_lwe_keyswitch_key.rs b/tfhe/src/core_crypto/entities/seeded_lwe_keyswitch_key.rs index be2d95fdea..cea9d5aa40 100644 --- a/tfhe/src/core_crypto/entities/seeded_lwe_keyswitch_key.rs +++ b/tfhe/src/core_crypto/entities/seeded_lwe_keyswitch_key.rs @@ -371,7 +371,8 @@ impl> ContiguousEntityCo type EntityViewMetadata = SeededLweCiphertextListCreationMetadata; - type EntityView<'this> = SeededLweCiphertextListView<'this, Self::Element> + type EntityView<'this> + = SeededLweCiphertextListView<'this, Self::Element> where Self: 'this; @@ -379,7 +380,8 @@ impl> ContiguousEntityCo // At the moment it does not make sense to return "sub" keyswitch keys. So we use a dummy // placeholder type here. - type SelfView<'this> = DummyCreateFrom + type SelfView<'this> + = DummyCreateFrom where Self: 'this; @@ -410,13 +412,15 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for SeededLweKeyswitchKey { - type EntityMutView<'this> = SeededLweCiphertextListMutView<'this, Self::Element> + type EntityMutView<'this> + = SeededLweCiphertextListMutView<'this, Self::Element> where Self: 'this; // At the moment it does not make sense to return "sub" keyswitch keys. So we use a dummy // placeholder type here. - type SelfMutView<'this> = DummyCreateFrom + type SelfMutView<'this> + = DummyCreateFrom where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/seeded_lwe_packing_keyswitch_key.rs b/tfhe/src/core_crypto/entities/seeded_lwe_packing_keyswitch_key.rs index fbd6b8cb2b..31daf5997b 100644 --- a/tfhe/src/core_crypto/entities/seeded_lwe_packing_keyswitch_key.rs +++ b/tfhe/src/core_crypto/entities/seeded_lwe_packing_keyswitch_key.rs @@ -406,7 +406,8 @@ impl> ContiguousEntityCo type EntityViewMetadata = SeededGlweCiphertextListCreationMetadata; - type EntityView<'this> = SeededGlweCiphertextListView<'this, Self::Element> + type EntityView<'this> + = SeededGlweCiphertextListView<'this, Self::Element> where Self: 'this; @@ -414,7 +415,8 @@ impl> ContiguousEntityCo // At the moment it does not make sense to return "sub" keyswitch keys. So we use a dummy // placeholder type here. - type SelfView<'this> = DummyCreateFrom + type SelfView<'this> + = DummyCreateFrom where Self: 'this; @@ -446,13 +448,15 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for SeededLwePackingKeyswitchKey { - type EntityMutView<'this> = SeededGlweCiphertextListMutView<'this, Self::Element> + type EntityMutView<'this> + = SeededGlweCiphertextListMutView<'this, Self::Element> where Self: 'this; // At the moment it does not make sense to return "sub" keyswitch keys. So we use a dummy // placeholder type here. - type SelfMutView<'this> = DummyCreateFrom + type SelfMutView<'this> + = DummyCreateFrom where Self: 'this; } diff --git a/tfhe/src/core_crypto/experimental/entities/pseudo_ggsw_ciphertext.rs b/tfhe/src/core_crypto/experimental/entities/pseudo_ggsw_ciphertext.rs index 90bb0dd8ea..64cdc9a2a3 100644 --- a/tfhe/src/core_crypto/experimental/entities/pseudo_ggsw_ciphertext.rs +++ b/tfhe/src/core_crypto/experimental/entities/pseudo_ggsw_ciphertext.rs @@ -714,13 +714,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = PseudoGgswLevelMatrixCreationMetadata; - type EntityView<'this> = PseudoGgswLevelMatrix<&'this [Self::Element]> + type EntityView<'this> + = PseudoGgswLevelMatrix<&'this [Self::Element]> where Self: 'this; type SelfViewMetadata = (); - type SelfView<'this> = DummyCreateFrom + type SelfView<'this> + = DummyCreateFrom where Self: 'this; @@ -750,11 +752,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for PseudoGgswCiphertext { - type EntityMutView<'this> = PseudoGgswLevelMatrix<&'this mut [Self::Element]> + type EntityMutView<'this> + = PseudoGgswLevelMatrix<&'this mut [Self::Element]> where Self: 'this; - type SelfMutView<'this> = DummyCreateFrom + type SelfMutView<'this> + = DummyCreateFrom where Self: 'this; } diff --git a/tfhe/src/core_crypto/fft_impl/fft64/crypto/bootstrap.rs b/tfhe/src/core_crypto/fft_impl/fft64/crypto/bootstrap.rs index 0bef9807cb..1e52acbe5c 100644 --- a/tfhe/src/core_crypto/fft_impl/fft64/crypto/bootstrap.rs +++ b/tfhe/src/core_crypto/fft_impl/fft64/crypto/bootstrap.rs @@ -105,7 +105,10 @@ impl> TryFrom> Versionize for FourierLweBootstrapKey { - type Versioned<'vers> = FourierLweBootstrapKeyVersioned<'vers> where C: 'vers; + type Versioned<'vers> + = FourierLweBootstrapKeyVersioned<'vers> + where + C: 'vers; fn versionize(&self) -> Self::Versioned<'_> { self.into() diff --git a/tfhe/src/core_crypto/fft_impl/fft64/crypto/ggsw.rs b/tfhe/src/core_crypto/fft_impl/fft64/crypto/ggsw.rs index 1e026d4ba6..4d188fec4d 100644 --- a/tfhe/src/core_crypto/fft_impl/fft64/crypto/ggsw.rs +++ b/tfhe/src/core_crypto/fft_impl/fft64/crypto/ggsw.rs @@ -96,7 +96,10 @@ impl> TryFrom> Versionize for FourierGgswCiphertext { - type Versioned<'vers> = FourierGgswCiphertextVersioned<'vers> where C: 'vers; + type Versioned<'vers> + = FourierGgswCiphertextVersioned<'vers> + where + C: 'vers; fn versionize(&self) -> Self::Versioned<'_> { self.into() diff --git a/tfhe/src/core_crypto/fft_impl/fft64/math/fft/mod.rs b/tfhe/src/core_crypto/fft_impl/fft64/math/fft/mod.rs index 47738e1cba..fa2e4322f1 100644 --- a/tfhe/src/core_crypto/fft_impl/fft64/math/fft/mod.rs +++ b/tfhe/src/core_crypto/fft_impl/fft64/math/fft/mod.rs @@ -590,7 +590,10 @@ impl> FourierPolynomialList { } impl> Versionize for FourierPolynomialList { - type Versioned<'vers> = FourierPolynomialListVersioned<'vers> where C: 'vers; + type Versioned<'vers> + = FourierPolynomialListVersioned<'vers> + where + C: 'vers; fn versionize(&self) -> Self::Versioned<'_> { self.into() diff --git a/tfhe/src/high_level_api/array/cpu/booleans.rs b/tfhe/src/high_level_api/array/cpu/booleans.rs index 20c86e94f5..8cbf12c8af 100644 --- a/tfhe/src/high_level_api/array/cpu/booleans.rs +++ b/tfhe/src/high_level_api/array/cpu/booleans.rs @@ -25,8 +25,14 @@ pub type CpuFheBoolSliceMut<'a> = super::super::FheBackendArraySliceMut<'a, CpuFheBoolArrayBackend, FheBoolId>; impl ArrayBackend for CpuFheBoolArrayBackend { - type Slice<'a> = &'a [BooleanBlock] where Self: 'a; - type SliceMut<'a> = &'a mut [BooleanBlock] where Self: 'a; + type Slice<'a> + = &'a [BooleanBlock] + where + Self: 'a; + type SliceMut<'a> + = &'a mut [BooleanBlock] + where + Self: 'a; type Owned = Vec; } diff --git a/tfhe/src/high_level_api/array/cpu/integers.rs b/tfhe/src/high_level_api/array/cpu/integers.rs index aaded91180..dd6be38fc3 100644 --- a/tfhe/src/high_level_api/array/cpu/integers.rs +++ b/tfhe/src/high_level_api/array/cpu/integers.rs @@ -42,10 +42,12 @@ impl ArrayBackend for CpuIntegerArrayBackend where T: IntegerRadixCiphertext, { - type Slice<'a> = &'a [T] + type Slice<'a> + = &'a [T] where Self: 'a; - type SliceMut<'a> = &'a mut [T] + type SliceMut<'a> + = &'a mut [T] where Self: 'a; type Owned = Vec; diff --git a/tfhe/src/high_level_api/array/cpu/mod.rs b/tfhe/src/high_level_api/array/cpu/mod.rs index a40e00df99..1092a9bd4d 100644 --- a/tfhe/src/high_level_api/array/cpu/mod.rs +++ b/tfhe/src/high_level_api/array/cpu/mod.rs @@ -46,8 +46,14 @@ impl ArrayBackend for ClearArrayBackend where T: Copy, { - type Slice<'a> = ClearContainer<&'a [T]> where Self: 'a; - type SliceMut<'a> = ClearContainer<&'a mut [T]> where Self: 'a; + type Slice<'a> + = ClearContainer<&'a [T]> + where + Self: 'a; + type SliceMut<'a> + = ClearContainer<&'a mut [T]> + where + Self: 'a; type Owned = ClearContainer>; } diff --git a/tfhe/src/high_level_api/array/dynamic/booleans.rs b/tfhe/src/high_level_api/array/dynamic/booleans.rs index fded14b61d..14f22decd1 100644 --- a/tfhe/src/high_level_api/array/dynamic/booleans.rs +++ b/tfhe/src/high_level_api/array/dynamic/booleans.rs @@ -22,8 +22,14 @@ pub type FheBoolSliceMut<'a> = FheBackendArraySliceMut<'a, DynFheBoolArrayBacken pub struct DynFheBoolArrayBackend; impl ArrayBackend for DynFheBoolArrayBackend { - type Slice<'a> = InnerBoolSlice<'a> where Self: 'a; - type SliceMut<'a> = InnerBoolSliceMut<'a> where Self: 'a; + type Slice<'a> + = InnerBoolSlice<'a> + where + Self: 'a; + type SliceMut<'a> + = InnerBoolSliceMut<'a> + where + Self: 'a; type Owned = InnerBoolArray; } diff --git a/tfhe/src/high_level_api/array/dynamic/signed.rs b/tfhe/src/high_level_api/array/dynamic/signed.rs index 9c3021482b..4b3f9e3363 100644 --- a/tfhe/src/high_level_api/array/dynamic/signed.rs +++ b/tfhe/src/high_level_api/array/dynamic/signed.rs @@ -155,8 +155,14 @@ pub type FheIntSliceMut<'a, Id> = FheBackendArraySliceMut<'a, DynIntBackend, Id> pub struct DynIntBackend; impl ArrayBackend for DynIntBackend { - type Slice<'a> = InnerIntSlice<'a> where Self: 'a; - type SliceMut<'a> = InnerIntSliceMut<'a> where Self: 'a; + type Slice<'a> + = InnerIntSlice<'a> + where + Self: 'a; + type SliceMut<'a> + = InnerIntSliceMut<'a> + where + Self: 'a; type Owned = InnerIntArray; } diff --git a/tfhe/src/high_level_api/array/mod.rs b/tfhe/src/high_level_api/array/mod.rs index d7b284573f..16cbf8b5d4 100644 --- a/tfhe/src/high_level_api/array/mod.rs +++ b/tfhe/src/high_level_api/array/mod.rs @@ -199,7 +199,8 @@ where Id: Default, C: BackendDataContainer, { - type Slice<'a> = FheArrayBase<::Slice<'a>, Id> + type Slice<'a> + = FheArrayBase<::Slice<'a>, Id> where Self: 'a; @@ -217,7 +218,8 @@ where Id: Default, C: BackendDataContainerMut, { - type SliceMut<'a> = FheArrayBase<::SliceMut<'a>, Id> + type SliceMut<'a> + = FheArrayBase<::SliceMut<'a>, Id> where Self: 'a; diff --git a/tfhe/src/high_level_api/tag.rs b/tfhe/src/high_level_api/tag.rs index 9010e43bbd..760b589530 100644 --- a/tfhe/src/high_level_api/tag.rs +++ b/tfhe/src/high_level_api/tag.rs @@ -228,7 +228,8 @@ impl<'de> serde::de::Visitor<'de> for SmallVecVisitor { } impl Versionize for SmallVec { - type Versioned<'vers> = &'vers [u8] + type Versioned<'vers> + = &'vers [u8] where Self: 'vers; diff --git a/tfhe/src/integer/server_key/comparator.rs b/tfhe/src/integer/server_key/comparator.rs index 3267d4433e..9e06bb3f60 100644 --- a/tfhe/src/integer/server_key/comparator.rs +++ b/tfhe/src/integer/server_key/comparator.rs @@ -88,9 +88,9 @@ impl<'a> Comparator<'a> { .key .generate_lookup_table(|x| if x < message_modulus { x } else { 0 }); - let rhs_lut = server_key.key.generate_lookup_table(|x| { - x.saturating_sub(message_modulus) - }); + let rhs_lut = server_key + .key + .generate_lookup_table(|x| x.saturating_sub(message_modulus)); Self { server_key, diff --git a/tfhe/src/shortint/parameters/mod.rs b/tfhe/src/shortint/parameters/mod.rs index 7f86e1e3d5..e6574e0f67 100644 --- a/tfhe/src/shortint/parameters/mod.rs +++ b/tfhe/src/shortint/parameters/mod.rs @@ -722,7 +722,7 @@ pub const BIVARIATE_PBS_COMPLIANT_PARAMETER_SET_VEC: [ClassicPBSParameters; 16] /// encoded over X (reps. Y) bits, i.e., message_modulus = 2^{X} (resp. carry_modulus = 2^{Y}). /// All parameter sets guarantee 128-bits of security and an error probability smaller than /// 2^{-40} for a PBS. -/// +/// /// Return a parameter set from a message and carry moduli. /// /// # Example diff --git a/tfhe/src/shortint/server_key/mod.rs b/tfhe/src/shortint/server_key/mod.rs index d33f7bb39e..4bc5bc05e3 100644 --- a/tfhe/src/shortint/server_key/mod.rs +++ b/tfhe/src/shortint/server_key/mod.rs @@ -243,7 +243,10 @@ impl> impl> Versionize for SerializableShortintBootstrappingKey { - type Versioned<'vers> = SerializableShortintBootstrappingKeyVersioned<'vers> where C: 'vers; + type Versioned<'vers> + = SerializableShortintBootstrappingKeyVersioned<'vers> + where + C: 'vers; fn versionize(&self) -> Self::Versioned<'_> { self.into() diff --git a/utils/tfhe-versionable/examples/manual_impl.rs b/utils/tfhe-versionable/examples/manual_impl.rs index 39bce5f43c..3b7be45e27 100644 --- a/utils/tfhe-versionable/examples/manual_impl.rs +++ b/utils/tfhe-versionable/examples/manual_impl.rs @@ -40,7 +40,8 @@ struct MyStructVersionOwned { } impl Versionize for MyStruct { - type Versioned<'vers> = MyStructVersionsDispatch<'vers, T> + type Versioned<'vers> + = MyStructVersionsDispatch<'vers, T> where Self: 'vers; diff --git a/utils/tfhe-versionable/src/lib.rs b/utils/tfhe-versionable/src/lib.rs index a1fc261e65..2888fc1393 100644 --- a/utils/tfhe-versionable/src/lib.rs +++ b/utils/tfhe-versionable/src/lib.rs @@ -174,7 +174,10 @@ pub trait UnversionizeVec: VersionizeVec { pub trait NotVersioned: Versionize {} impl VersionizeSlice for T { - type VersionedSlice<'vers> = &'vers [T] where T: 'vers; + type VersionedSlice<'vers> + = &'vers [T] + where + T: 'vers; fn versionize_slice(slice: &[Self]) -> Self::VersionedSlice<'_> { slice @@ -246,7 +249,10 @@ impl_scalar_versionize!(f64); impl_scalar_versionize!(char); impl Versionize for Wrapping { - type Versioned<'vers> = Wrapping> where T: 'vers; + type Versioned<'vers> + = Wrapping> + where + T: 'vers; fn versionize(&self) -> Self::Versioned<'_> { Wrapping(self.0.versionize()) @@ -270,7 +276,10 @@ impl Unversionize for Wrapping { impl NotVersioned for Wrapping {} impl Versionize for Box { - type Versioned<'vers> = T::Versioned<'vers> where T: 'vers; + type Versioned<'vers> + = T::Versioned<'vers> + where + T: 'vers; fn versionize(&self) -> Self::Versioned<'_> { self.as_ref().versionize() @@ -292,7 +301,10 @@ impl Unversionize for Box { } impl Versionize for Box<[T]> { - type Versioned<'vers> = T::VersionedSlice<'vers> where T: 'vers; + type Versioned<'vers> + = T::VersionedSlice<'vers> + where + T: 'vers; fn versionize(&self) -> Self::Versioned<'_> { T::versionize_slice(self) @@ -324,7 +336,10 @@ impl VersionizeVec for Box<[T]> { } impl VersionizeSlice for Box<[T]> { - type VersionedSlice<'vers> = Vec> where T: 'vers; + type VersionedSlice<'vers> + = Vec> + where + T: 'vers; fn versionize_slice(slice: &[Self]) -> Self::VersionedSlice<'_> { slice @@ -344,7 +359,10 @@ impl UnversionizeVec for Box<[T]> { } impl Versionize for Vec { - type Versioned<'vers> = T::VersionedSlice<'vers> where T: 'vers; + type Versioned<'vers> + = T::VersionedSlice<'vers> + where + T: 'vers; fn versionize(&self) -> Self::Versioned<'_> { T::versionize_slice(self) @@ -376,7 +394,10 @@ impl VersionizeVec for Vec { } impl VersionizeSlice for Vec { - type VersionedSlice<'vers> = Vec> where T: 'vers; + type VersionedSlice<'vers> + = Vec> + where + T: 'vers; fn versionize_slice(slice: &[Self]) -> Self::VersionedSlice<'_> { slice @@ -396,7 +417,10 @@ impl UnversionizeVec for Vec { } impl Versionize for [T] { - type Versioned<'vers> = T::VersionedSlice<'vers> where T: 'vers; + type Versioned<'vers> + = T::VersionedSlice<'vers> + where + T: 'vers; fn versionize(&self) -> Self::Versioned<'_> { T::versionize_slice(self) @@ -422,7 +446,11 @@ impl VersionizeVec for &[T] { } impl<'a, T: VersionizeSlice> VersionizeSlice for &'a [T] { - type VersionedSlice<'vers> = Vec> where T: 'vers, 'a: 'vers; + type VersionedSlice<'vers> + = Vec> + where + T: 'vers, + 'a: 'vers; fn versionize_slice(slice: &[Self]) -> Self::VersionedSlice<'_> { slice @@ -435,7 +463,10 @@ impl<'a, T: VersionizeSlice> VersionizeSlice for &'a [T] { // Since serde doesn't support arbitrary length arrays with const generics, the array // is converted to a slice/vec. impl Versionize for [T; N] { - type Versioned<'vers> = T::VersionedSlice<'vers> where T: 'vers; + type Versioned<'vers> + = T::VersionedSlice<'vers> + where + T: 'vers; fn versionize(&self) -> Self::Versioned<'_> { T::versionize_slice(self) @@ -474,7 +505,10 @@ impl VersionizeVec for [T; N] { } impl VersionizeSlice for [T; N] { - type VersionedSlice<'vers> = Vec> where T: 'vers; + type VersionedSlice<'vers> + = Vec> + where + T: 'vers; fn versionize_slice(slice: &[Self]) -> Self::VersionedSlice<'_> { slice @@ -533,7 +567,10 @@ impl VersionizeOwned for &str { impl NotVersioned for str {} impl Versionize for Option { - type Versioned<'vers> = Option> where T: 'vers; + type Versioned<'vers> + = Option> + where + T: 'vers; fn versionize(&self) -> Self::Versioned<'_> { self.as_ref().map(|val| val.versionize()) @@ -557,7 +594,8 @@ impl Unversionize for Option { impl NotVersioned for Option {} impl Versionize for PhantomData { - type Versioned<'vers> = Self + type Versioned<'vers> + = Self where Self: 'vers; @@ -583,7 +621,8 @@ impl Unversionize for PhantomData { impl NotVersioned for PhantomData {} impl Versionize for Arc { - type Versioned<'vers> = T::Versioned<'vers> + type Versioned<'vers> + = T::Versioned<'vers> where T: 'vers; @@ -609,7 +648,10 @@ impl Unversionize for Arc { impl NotVersioned for Arc {} impl Versionize for Complex { - type Versioned<'vers> = Complex> where T: 'vers; + type Versioned<'vers> + = Complex> + where + T: 'vers; fn versionize(&self) -> Self::Versioned<'_> { Complex { @@ -642,7 +684,10 @@ impl Unversionize for Complex { impl NotVersioned for Complex {} impl Versionize for ABox { - type Versioned<'vers> = T::Versioned<'vers> where T: 'vers; + type Versioned<'vers> + = T::Versioned<'vers> + where + T: 'vers; fn versionize(&self) -> Self::Versioned<'_> { self.as_ref().versionize() @@ -668,7 +713,10 @@ where } impl Versionize for ABox<[T]> { - type Versioned<'vers> = T::VersionedSlice<'vers> where T: 'vers; + type Versioned<'vers> + = T::VersionedSlice<'vers> + where + T: 'vers; fn versionize(&self) -> Self::Versioned<'_> { T::versionize_slice(self) @@ -692,7 +740,10 @@ impl Unversionize for ABox<[T]> { impl NotVersioned for ABox<[T]> {} impl Versionize for AVec { - type Versioned<'vers> = T::VersionedSlice<'vers> where T: 'vers; + type Versioned<'vers> + = T::VersionedSlice<'vers> + where + T: 'vers; fn versionize(&self) -> Self::Versioned<'_> { T::versionize_slice(self) @@ -738,7 +789,11 @@ impl NotVersioned for () {} // TODO: use a macro for more tuple sizes impl Versionize for (T, U) { - type Versioned<'vers> = (T::Versioned<'vers>, U::Versioned<'vers>) where T: 'vers, U: 'vers; + type Versioned<'vers> + = (T::Versioned<'vers>, U::Versioned<'vers>) + where + T: 'vers, + U: 'vers; fn versionize(&self) -> Self::Versioned<'_> { (self.0.versionize(), self.1.versionize()) @@ -760,7 +815,11 @@ impl Unversionize for (T, U) { } impl VersionizeSlice for (T, U) { - type VersionedSlice<'vers> = Vec<(T::Versioned<'vers>, U::Versioned<'vers>)> where T: 'vers, U: 'vers; + type VersionedSlice<'vers> + = Vec<(T::Versioned<'vers>, U::Versioned<'vers>)> + where + T: 'vers, + U: 'vers; fn versionize_slice(slice: &[Self]) -> Self::VersionedSlice<'_> { slice @@ -790,7 +849,16 @@ impl UnversionizeVec for (T, U) { } impl Versionize for (T, U, V) { - type Versioned<'vers> = (T::Versioned<'vers>, U::Versioned<'vers>, V::Versioned<'vers>) where T: 'vers, U: 'vers, V: 'vers; + type Versioned<'vers> + = ( + T::Versioned<'vers>, + U::Versioned<'vers>, + V::Versioned<'vers>, + ) + where + T: 'vers, + U: 'vers, + V: 'vers; fn versionize(&self) -> Self::Versioned<'_> { ( @@ -824,7 +892,16 @@ impl Unversionize for (T, U, } impl VersionizeSlice for (T, U, V) { - type VersionedSlice<'vers> = Vec<(T::Versioned<'vers>, U::Versioned<'vers>, V::Versioned<'vers>)> where T: 'vers, U: 'vers, V: 'vers; + type VersionedSlice<'vers> + = Vec<( + T::Versioned<'vers>, + U::Versioned<'vers>, + V::Versioned<'vers>, + )> + where + T: 'vers, + U: 'vers, + V: 'vers; fn versionize_slice(slice: &[Self]) -> Self::VersionedSlice<'_> { slice @@ -868,7 +945,8 @@ impl UnversionizeVec for (T, // converts to `Vec` for the versioned type, so we don't have to derive // Eq/Hash on it. impl Versionize for HashSet { - type Versioned<'vers> = Vec> + type Versioned<'vers> + = Vec> where T: 'vers; @@ -897,7 +975,11 @@ impl Unversionize for HashSet { // converts to `Vec<(K::Versioned, V::Versioned)>` for the versioned type, so we don't have to // derive Eq/Hash on it. impl Versionize for HashMap { - type Versioned<'vers> = Vec<(K::Versioned<'vers>, V::Versioned<'vers>)> where K: 'vers, V: 'vers; + type Versioned<'vers> + = Vec<(K::Versioned<'vers>, V::Versioned<'vers>)> + where + K: 'vers, + V: 'vers; fn versionize(&self) -> Self::Versioned<'_> { self.iter()