1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use super::engine_error;
use crate::specification::engines::AbstractEngine;
use crate::specification::entities::LweCiphertextEntity;
engine_error! {
LweCiphertextConsumingRetrievalError for LweCiphertextConsumingRetrievalEngine @
}
/// A trait for engines retrieving the content of the container from an LWE ciphertext consuming it
/// in the process.
///
/// # Semantics
///
/// This [pure](super#operation-semantics) operation retrieves the content of the container from the
/// `input` LWE ciphertext consuming it in the process.
pub trait LweCiphertextConsumingRetrievalEngine<Ciphertext, Container>: AbstractEngine
where
Ciphertext: LweCiphertextEntity,
{
/// Retrieves the content of the container from an LWE ciphertext, consuming it in the process.
fn consume_retrieve_lwe_ciphertext(
&mut self,
ciphertext: Ciphertext,
) -> Result<Container, LweCiphertextConsumingRetrievalError<Self::EngineError>>;
/// Unsafely retrieves the content of the container from an LWE ciphertext, consuming it in the
/// process.
///
/// # Safety
/// For the _general_ safety concerns regarding this operation, refer to the different variants
/// of [`LweCiphertextConsumingRetrievalError`]. For safety concerns _specific_ to an engine,
/// refer to the implementer safety section.
unsafe fn consume_retrieve_lwe_ciphertext_unchecked(
&mut self,
ciphertext: Ciphertext,
) -> Container;
}