snarkvm_console_account

Trait FromField

Source
pub trait FromField {
    type Field: FieldTrait;

    // Required method
    fn from_field(field: &Self::Field) -> Result<Self, Error>
       where Self: Sized;
}
Expand description

Unary operator for converting from a base field element.

Required Associated Types§

Required Methods§

Source

fn from_field(field: &Self::Field) -> Result<Self, Error>
where Self: Sized,

Initializes an object from a base field element.

Implementations on Foreign Types§

Source§

impl<E, I> FromField for Integer<E, I>
where E: Environment, I: IntegerType,

Source§

fn from_field( field: &<Integer<E, I> as FromField>::Field, ) -> Result<Integer<E, I>, Error>

Casts an integer from a base field.

This method guarantees the following:

  1. If the field element is larger than the integer domain, then the operation will fail.
  2. If the field element is smaller than the integer domain, then the operation will succeed.
Source§

type Field = Field<E>

Implementors§

Source§

impl<E> FromField for Address<E>
where E: Environment,

Source§

impl<E> FromField for Group<E>
where E: Environment,

Source§

impl<E> FromField for Scalar<E>
where E: Environment,