pub struct FheProgramNode<T: NumCiphertexts> {
    pub ids: &'static [NodeIndex],
    /* private fields */
}
Expand description

A type that wraps an FheType during graph construction. It is an implementation detail and you should not construct these directly. Outside of very specific semantics, use-after-free and other undefined behaviors may occur.

Remarks

This type serves as an anchor so users can apply +, *, -, /, <<, and >> operators on types inside an FHE program function. If the underlying type T implements the GraphCipherAdd, GraphCipherMul, etc trait, then FheProgramNode<T> implements std::ops::Add, std::ops::Mul, etc and proxies to T’s underlying implementation.

This type impls the Copy trait so users don’t have to call .clone() all the time. Unfortunately, this rules out the clean implementation of using a Vec<NodeIndex> to store the graph nodes T represents; Vec does not impl Copy, and thus it cannot exist in this type. To circumvent this limitation, we use a threadlocal arena of NodeIndex to allocate and copy slices. This requires we lie about the lifetime of ids, which isn’t actually ’static, but rather until we clear the arena. We clean the arena in the FHE program macro after FHE program construction and thus after all FheProgramNodes have gone out of scope.

You should never explicitly construct these outside of e.g. FHE type GraphCipherPlainAdd traits, which run during graph construction.

Undefined behavior

These types must be constructed while a crate::CURRENT_CTX refers to a valid crate::Context. Furthermore, no FheProgramNode should outlive the said context. Violating any of these conditions may result in memory corruption or use-after-free.

Fields

ids: &'static [NodeIndex]

The ids on this node. The ’static lifetime on this slice is a lie. The sunscreen compiler must ensure that no FheProgramNode exists after FHE program construction.

Implementations

Creates a new FHE program node with the given node index.

These are an implementation detail needed while constructing the FHE program graph and should not be constructed at any other time. You should never need to directly create a FheProgramNode.

Remarks

This type internally captures a slice rather than directly storing its own Vec. We do this so the type can impl Copy and composing FHE programs is natural without the user needing to call clone() all the time.

Undefined behavior

This type references memory in a bump allocator. Failing to ensure FheProgramNodes never outlive the backing context, will result in use-after-free.

Returns the plain modulus parameter for the given BFV scheme

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

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

Formats the value using the given formatter. 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

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 type returned by the input fn`.

Creates a new FheProgramNode denoted as an input to an Fhe Program graph. Read more

The number of lanes.

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

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

The number of ciphertexts this type decomposes into.

The captured object return type.

Denote this object is an output by appending an appropriate output FHE program nodes Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

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 result type. Typically, this should just be Self.

Performs a row swap.

Returns the Type of the &self. Lives only on the instance so you can be object-safe for use in dyn TypeName. 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

Compare self to key and return true if they are equal.

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

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.