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
impl<SF, DF> RefUnwindSafe for KeyCacher<SF, DF>where
DF: RefUnwindSafe,
SF: RefUnwindSafe,
impl<SF, DF> Send for KeyCacher<SF, DF>where
DF: Send,
SF: Send,
impl<SF, DF> Sync for KeyCacher<SF, DF>where
DF: Sync,
SF: Sync,
impl<SF, DF> Unpin for KeyCacher<SF, DF>where
DF: Unpin,
SF: Unpin,
impl<SF, DF> UnwindSafe for KeyCacher<SF, DF>where
DF: UnwindSafe,
SF: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more