diff --git a/tfhe/src/core_crypto/entities/plaintext.rs b/tfhe/src/core_crypto/entities/plaintext.rs index 464ab7eba..758c69caf 100644 --- a/tfhe/src/core_crypto/entities/plaintext.rs +++ b/tfhe/src/core_crypto/entities/plaintext.rs @@ -1,6 +1,28 @@ use crate::core_crypto::commons::traits::*; -/// A plaintext (encoded) value. +/// A plaintext (encoded) value. This may contain a reference, in that case it can be converted to a +/// plaintext containing the actual value via a call to `into`. +/// +/// ``` +/// use tfhe::core_crypto::entities::*; +/// +/// # pub fn main() { +/// +/// pub fn takes_plaintext(plain: Plaintext) { +/// println!("{plain:?}"); +/// } +/// +/// let encoded_msg = 3u64 << 60; +/// +/// let normal_plaintext = Plaintext(encoded_msg); +/// takes_plaintext(normal_plaintext); +/// +/// // A plaintext containing a reference can be returned by iterators for example, here is how +/// // to convert them painlessly. +/// let ref_plaintext = Plaintext(&encoded_msg); +/// takes_plaintext(ref_plaintext.into()); +/// # } +/// ``` #[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] pub struct Plaintext(pub T);