Trait snarkvm_circuit_types::prelude::from::FromField
source · pub trait FromField {
type Field: FieldTrait;
// Required method
fn from_field(field: Self::Field) -> Self;
}
Expand description
Unary operator for converting from a base field element.
Required Associated Types§
type Field: FieldTrait
Required Methods§
sourcefn from_field(field: Self::Field) -> Self
fn from_field(field: Self::Field) -> Self
Casts a circuit from a base field element.
Implementations on Foreign Types§
source§impl<E, I> FromField for Integer<E, I>where
E: Environment,
I: IntegerType,
impl<E, I> FromField for Integer<E, I>where E: Environment, I: IntegerType,
source§fn from_field(field: <Integer<E, I> as FromField>::Field) -> Integer<E, I>
fn from_field(field: <Integer<E, I> as FromField>::Field) -> Integer<E, I>
Casts an integer from a base field.
This method guarantees the following:
- If the field element is larger than the integer domain, then the operation will fail.
- If the field element is smaller than the integer domain, then the operation will succeed.