core_utils/circuit/
constants.rs1use enum_try_as_inner::EnumTryAsInner;
2use primitives::algebra::{
3 elliptic_curve::{BaseFieldElement, Point, Scalar},
4 field::Bit,
5};
6use serde::{Deserialize, Serialize};
7
8#[derive(Debug, Copy, Clone, EnumTryAsInner, PartialEq, Eq, Serialize, Deserialize)]
11pub enum Plaintext<T> {
12 Fixed(T),
13 Input(usize),
14}
15
16pub type ScalarPlaintext<C> = Plaintext<Scalar<C>>;
17pub type BaseFieldPlaintext<C> = Plaintext<BaseFieldElement<C>>;
18pub type PointPlaintext<C> = Plaintext<Point<C>>;
19pub type BitPlaintext = Plaintext<Bit>;
20
21pub type ScalarPlaintextBatch<C> = Plaintext<Vec<Scalar<C>>>;
22pub type BaseFieldPlaintextBatch<C> = Plaintext<Vec<BaseFieldElement<C>>>;
23pub type PointPlaintextBatch<C> = Plaintext<Vec<Point<C>>>;
24pub type BitPlaintextBatch = Plaintext<Vec<Bit>>;
25
26impl<T> Plaintext<Vec<T>> {
27 pub fn len(&self) -> usize {
29 match self {
30 Plaintext::Fixed(v) => v.len(),
31 Plaintext::Input(size) => *size,
32 }
33 }
34
35 pub fn is_empty(&self) -> bool {
36 self.len() == 0
37 }
38}