chore(core): update Plaintext docstring

This commit is contained in:
Arthur Meyre
2022-12-06 17:31:01 +01:00
committed by jborfila
parent 80a426f1df
commit fe31bbf7c1

View File

@@ -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<u64>) {
/// 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<T>(pub T);