pub struct CompressedFheInt<Id>where
Id: FheIntId,{ /* private fields */ }
Available on crate feature
integer
only.Expand description
Compressed FheInt
Meant to save in storage space / transfer.
- A Compressed type must be decompressed using decompress before it can be used.
- It is not possible to compress an existing FheInt. compression can only be achieved at encryption time by a ClientKey
§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, CompressedFheInt32, ConfigBuilder};
let (client_key, _) = generate_keys(ConfigBuilder::default());
let compressed = CompressedFheInt32::encrypt(i32::MIN, &client_key);
let decompressed = compressed.decompress();
let decrypted: i32 = decompressed.decrypt(&client_key);
assert_eq!(decrypted, i32::MIN);
Implementations§
Source§impl<Id> CompressedFheInt<Id>where
Id: FheIntId,
impl<Id> CompressedFheInt<Id>where
Id: FheIntId,
pub fn into_raw_parts(self) -> (CompressedSignedRadixCiphertext, Id, Tag)
pub fn from_raw_parts( ciphertext: CompressedSignedRadixCiphertext, id: Id, tag: Tag, ) -> Self
Source§impl<Id> CompressedFheInt<Id>where
Id: FheIntId,
impl<Id> CompressedFheInt<Id>where
Id: FheIntId,
Sourcepub fn decompress(&self) -> FheInt<Id>
pub fn decompress(&self) -> FheInt<Id>
Decompress to a FheInt
See CompressedFheInt example.
Trait Implementations§
Source§impl<Id> Clone for CompressedFheInt<Id>where
Id: FheIntId + Clone,
impl<Id> Clone for CompressedFheInt<Id>where
Id: FheIntId + Clone,
Source§fn clone(&self) -> CompressedFheInt<Id>
fn clone(&self) -> CompressedFheInt<Id>
Returns a duplicate 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 CompressedFheInt<Id>where
Id: FheIntId + Deserialize<'de>,
impl<'de, Id> Deserialize<'de> for CompressedFheInt<Id>where
Id: FheIntId + Deserialize<'de>,
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<Id, T> FheTryEncrypt<T, ClientKey> for CompressedFheInt<Id>
impl<Id, T> FheTryEncrypt<T, ClientKey> for CompressedFheInt<Id>
Source§impl<Id: FheIntId> Named for CompressedFheInt<Id>
impl<Id: FheIntId> Named for CompressedFheInt<Id>
Source§impl<Id: FheIntId> ParameterSetConformant for CompressedFheInt<Id>
impl<Id: FheIntId> ParameterSetConformant for CompressedFheInt<Id>
type ParameterSet = FheIntConformanceParams<Id>
fn is_conformant(&self, params: &FheIntConformanceParams<Id>) -> bool
Source§impl<Id> Serialize for CompressedFheInt<Id>where
Id: FheIntId + Serialize,
impl<Id> Serialize for CompressedFheInt<Id>where
Id: FheIntId + Serialize,
Source§impl<Id> Tagged for CompressedFheInt<Id>where
Id: FheIntId,
impl<Id> Tagged for CompressedFheInt<Id>where
Id: FheIntId,
Source§impl<Id> Unversionize for CompressedFheInt<Id>where
Id: FheIntId,
CompressedFheIntVersions<Id>: VersionsDispatch<Self>,
impl<Id> Unversionize for CompressedFheInt<Id>where
Id: FheIntId,
CompressedFheIntVersions<Id>: VersionsDispatch<Self>,
Source§fn unversionize(
versioned: Self::VersionedOwned,
) -> Result<Self, UnversionizeError>
fn unversionize( versioned: Self::VersionedOwned, ) -> Result<Self, UnversionizeError>
Creates an object from a versioned enum, and eventually upgrades from previous
variants.
Source§impl<Id> UnversionizeVec for CompressedFheInt<Id>where
Id: FheIntId,
CompressedFheIntVersions<Id>: VersionsDispatch<Self>,
impl<Id> UnversionizeVec for CompressedFheInt<Id>where
Id: FheIntId,
CompressedFheIntVersions<Id>: VersionsDispatch<Self>,
fn unversionize_vec( versioned: Self::VersionedVec, ) -> Result<Vec<Self>, UnversionizeError>
Source§impl<Id: FheIntId> Upgrade<CompressedFheInt<Id>> for CompressedFheIntV0<Id>
impl<Id: FheIntId> Upgrade<CompressedFheInt<Id>> for CompressedFheIntV0<Id>
type Error = Infallible
fn upgrade(self) -> Result<CompressedFheInt<Id>, Self::Error>
Source§impl<Id> Version for CompressedFheInt<Id>where
Id: FheIntId + VersionizeOwned + Unversionize + Versionize,
CompressedSignedRadixCiphertext: VersionizeOwned + Unversionize + Versionize,
Tag: VersionizeOwned + Unversionize + Versionize,
impl<Id> Version for CompressedFheInt<Id>where
Id: FheIntId + VersionizeOwned + Unversionize + Versionize,
CompressedSignedRadixCiphertext: VersionizeOwned + Unversionize + Versionize,
Tag: VersionizeOwned + Unversionize + Versionize,
Source§impl<Id> Versionize for CompressedFheInt<Id>where
Id: FheIntId,
CompressedFheIntVersions<Id>: VersionsDispatch<Self>,
impl<Id> Versionize for CompressedFheInt<Id>where
Id: FheIntId,
CompressedFheIntVersions<Id>: VersionsDispatch<Self>,
Source§type Versioned<'vers> = <CompressedFheIntVersions<Id> as VersionsDispatch<CompressedFheInt<Id>>>::Ref<'vers>
where
Id: FheIntId + 'vers
type Versioned<'vers> = <CompressedFheIntVersions<Id> as VersionsDispatch<CompressedFheInt<Id>>>::Ref<'vers> where Id: FheIntId + 'vers
The equivalent versioned type. It should have a variant for each version.
It may own the underlying data or only hold a read-only reference to it.
Source§fn versionize(&self) -> Self::Versioned<'_>
fn versionize(&self) -> Self::Versioned<'_>
Wraps the object into a versioned enum with a variant for each version. This will
use references on the underlying types if possible.
Source§impl<Id> VersionizeOwned for CompressedFheInt<Id>where
Id: FheIntId,
CompressedFheIntVersions<Id>: VersionsDispatch<Self>,
impl<Id> VersionizeOwned for CompressedFheInt<Id>where
Id: FheIntId,
CompressedFheIntVersions<Id>: VersionsDispatch<Self>,
type VersionedOwned = <CompressedFheIntVersions<Id> as VersionsDispatch<CompressedFheInt<Id>>>::Owned where Id: FheIntId
Source§fn versionize_owned(self) -> Self::VersionedOwned
fn versionize_owned(self) -> Self::VersionedOwned
Wraps the object into a versioned enum with a variant for each version. This will
clone the underlying types.
Source§impl<Id> VersionizeSlice for CompressedFheInt<Id>where
Id: FheIntId,
CompressedFheIntVersions<Id>: VersionsDispatch<Self>,
impl<Id> VersionizeSlice for CompressedFheInt<Id>where
Id: FheIntId,
CompressedFheIntVersions<Id>: VersionsDispatch<Self>,
type VersionedSlice<'vers> = Vec<<CompressedFheInt<Id> as Versionize>::Versioned<'vers>> where Id: FheIntId + 'vers
fn versionize_slice(slice: &[Self]) -> Self::VersionedSlice<'_>
Source§impl<Id> VersionizeVec for CompressedFheInt<Id>where
Id: FheIntId,
CompressedFheIntVersions<Id>: VersionsDispatch<Self>,
impl<Id> VersionizeVec for CompressedFheInt<Id>where
Id: FheIntId,
CompressedFheIntVersions<Id>: VersionsDispatch<Self>,
type VersionedVec = Vec<<CompressedFheInt<Id> as VersionizeOwned>::VersionedOwned> where Id: FheIntId
fn versionize_vec(vec: Vec<Self>) -> Self::VersionedVec
Source§impl<Id: FheIntId> VersionsDispatch<CompressedFheInt<Id>> for CompressedFheIntVersions<Id>where
CompressedFheIntV0<Id>: Version + Upgrade<CompressedFheInt<Id>>,
CompressedFheInt<Id>: Version,
impl<Id: FheIntId> VersionsDispatch<CompressedFheInt<Id>> for CompressedFheIntVersions<Id>where
CompressedFheIntV0<Id>: Version + Upgrade<CompressedFheInt<Id>>,
CompressedFheInt<Id>: Version,
Auto Trait Implementations§
impl<Id> Freeze for CompressedFheInt<Id>where
Id: Freeze,
impl<Id> RefUnwindSafe for CompressedFheInt<Id>where
Id: RefUnwindSafe,
impl<Id> Send for CompressedFheInt<Id>where
Id: Send,
impl<Id> Sync for CompressedFheInt<Id>where
Id: Sync,
impl<Id> Unpin for CompressedFheInt<Id>where
Id: Unpin,
impl<Id> UnwindSafe for CompressedFheInt<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Clear, Key, T> FheEncrypt<Clear, Key> for Twhere
T: FheTryEncrypt<Clear, Key>,
impl<Clear, Key, T> FheEncrypt<Clear, Key> for Twhere
T: FheTryEncrypt<Clear, Key>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more