mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-08 22:28:01 -05:00
chore(core): update Plaintext docstring
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user