Struct concrete::KeyCacher

source ·
pub struct KeyCacher<SF, DF> { /* private fields */ }
Available on crate feature serde only.
Expand description

KeyCacher

This struct is a very simple “key cache” meant to speedup execution time by not having to generate the key for the given config each time.

Limitations

For now this cacher is extremely basic, if you were to change the config between runs and still use the same path, the cacher wouldn’t detect that you’d end up with wrong keys.

Example

with bincode in your cargo dependencies:

const KEY_PATH: &str = "../keys/fheuint3and2.bin";

fn main() {
    use concrete::{ConfigBuilder, KeyCacher};
    let config = ConfigBuilder::all_disabled()
        .enable_default_uint2()
        .enable_default_uint3()
        .build();

    // The key will be generated on the first run and saved to the
    // the filepath `KEY_PATH` so later runs will read this file
    // and avoid regenerating keys.
    let (client_key, server_key) = KeyCacher::new(
        KEY_PATH,
        config,
        bincode::serialize_into,
        bincode::deserialize_from,
    )
    .get();
}

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.