Struct tfhe::CompactFheIntList
source · pub struct CompactFheIntList<Id: FheIntId> { /* private fields */ }
Available on crate feature
integer
only.Expand description
Compact list of FheInt
Meant to save in storage space / transfer.
- A Compact type must be expanded using expand before it can be used.
- It is not possible to ‘compact’ an existing FheInt. Compacting can only be achieved at encryption time by a CompactPublicKey
§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, CompactFheInt32List, CompactPublicKey, ConfigBuilder, FheInt32};
let (client_key, _) = generate_keys(ConfigBuilder::default());
let compact_public_key = CompactPublicKey::try_new(&client_key).unwrap();
let clears = vec![i32::MAX, i32::MIN, 0, 1];
let compact = CompactFheInt32List::encrypt(&clears, &compact_public_key);
assert_eq!(compact.len(), clears.len());
let ciphertexts = compact.expand();
let decrypted: Vec<i32> = ciphertexts
.into_iter()
.map(|ciphertext| ciphertext.decrypt(&client_key))
.collect();
assert_eq!(decrypted, clears);
Implementations§
source§impl<Id> CompactFheIntList<Id>where
Id: FheIntId,
impl<Id> CompactFheIntList<Id>where
Id: FheIntId,
pub fn is_empty(&self) -> bool
pub fn into_raw_parts(self) -> (CompactCiphertextList, Id)
pub fn from_raw_parts(list: CompactCiphertextList, id: Id) -> Self
Trait Implementations§
source§impl<Id: Clone + FheIntId> Clone for CompactFheIntList<Id>
impl<Id: Clone + FheIntId> Clone for CompactFheIntList<Id>
source§fn clone(&self) -> CompactFheIntList<Id>
fn clone(&self) -> CompactFheIntList<Id>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<'de, Id> Deserialize<'de> for CompactFheIntList<Id>where
Id: Deserialize<'de> + FheIntId,
impl<'de, Id> Deserialize<'de> for CompactFheIntList<Id>where
Id: Deserialize<'de> + FheIntId,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<'a, Id, T> FheTryEncrypt<&'a [T], CompactPublicKey> for CompactFheIntList<Id>where
T: DecomposableInto<u64>,
Id: FheIntId,
impl<'a, Id, T> FheTryEncrypt<&'a [T], CompactPublicKey> for CompactFheIntList<Id>where
T: DecomposableInto<u64>,
Id: FheIntId,
type Error = Error
fn try_encrypt( values: &'a [T], key: &CompactPublicKey ) -> Result<Self, Self::Error>
source§impl<Id: FheIntId> Named for CompactFheIntList<Id>
impl<Id: FheIntId> Named for CompactFheIntList<Id>
source§impl<Id: FheIntId> ParameterSetConformant for CompactFheIntList<Id>
impl<Id: FheIntId> ParameterSetConformant for CompactFheIntList<Id>
type ParameterSet = CompactFheIntListConformanceParams<Id>
fn is_conformant(&self, params: &CompactFheIntListConformanceParams<Id>) -> bool
Auto Trait Implementations§
impl<Id> Freeze for CompactFheIntList<Id>where
Id: Freeze,
impl<Id> RefUnwindSafe for CompactFheIntList<Id>where
Id: RefUnwindSafe,
impl<Id> Send for CompactFheIntList<Id>where
Id: Send,
impl<Id> Sync for CompactFheIntList<Id>where
Id: Sync,
impl<Id> Unpin for CompactFheIntList<Id>where
Id: Unpin,
impl<Id> UnwindSafe for CompactFheIntList<Id>where
Id: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more