pub struct FheBool { /* private fields */ }
Available on crate feature booleans only.
Expand description

The FHE boolean data type.

To be able to use this type, the cargo feature booleans must be enabled, and your config should also enable the type with either default parameters or custom ones.

Example

use concrete::prelude::*;
#[cfg(feature = "booleans")]
use concrete::{generate_keys, set_server_key, ConfigBuilder, FheBool};

// Enable booleans in the config
let config = ConfigBuilder::all_disabled().enable_default_bool().build();

// With the booleans enabled in the config, the needed keys and details
// can be taken care of.
let (client_key, server_key) = generate_keys(config);

let ttrue = FheBool::encrypt(true, &client_key);
let ffalse = FheBool::encrypt(false, &client_key);

// Do not forget to set the server key before doing any computation
set_server_key(server_key);

let fhe_result = ttrue & ffalse;

let clear_result = fhe_result.decrypt(&client_key);
assert_eq!(clear_result, false);

Implementations

Trait Implementations

The resulting type after applying the & operator.

Performs the & operation. Read more

The resulting type after applying the & operator.

Performs the & operation. Read more

The resulting type after applying the | operator.

Performs the | operation. Read more

The resulting type after applying the | operator.

Performs the | operation. Read more

The resulting type after applying the ^ operator.

Performs the ^ operation. Read more

The resulting type after applying the ^ operator.

Performs the ^ operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Deserialize this value from the given Serde deserializer. Read more

Converts to this type from the input type.

The resulting type after applying the ! operator.

Performs the unary ! operation. Read more

The resulting type after applying the ! operator.

Performs the unary ! operation. Read more

Serialize this value into the given Serde serializer. Read more

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 resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

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.