use super::*;
impl<A: Aleo> From<Vec<Field<A>>> for Ciphertext<A> {
fn from(fields: Vec<Field<A>>) -> Self {
match fields.len() <= A::MAX_DATA_SIZE_IN_FIELDS as usize {
true => Self(fields),
false => A::halt("Ciphertext exceeds maximum allowed size"),
}
}
}
impl<A: Aleo> From<&[Field<A>]> for Ciphertext<A> {
fn from(fields: &[Field<A>]) -> Self {
Self::from_fields(fields)
}
}
impl<A: Aleo> FromFields for Ciphertext<A> {
type Field = Field<A>;
fn from_fields(fields: &[Self::Field]) -> Self {
Self::from(fields.to_vec())
}
}