pub trait Cast<T: Sized = Self> {
// Required method
fn cast(&self) -> T;
}
Expand description
Unary operator for casting values of one type to another.
Required Methods§
Implementations on Foreign Types§
Source§impl<E: Environment> Cast for Boolean<E>
impl<E: Environment> Cast for Boolean<E>
Source§impl<E: Environment> Cast for Field<E>
impl<E: Environment> Cast for Field<E>
Source§impl<E: Environment> Cast for Scalar<E>
impl<E: Environment> Cast for Scalar<E>
Source§impl<E: Environment> Cast<Address<E>> for Scalar<E>
impl<E: Environment> Cast<Address<E>> for Scalar<E>
Source§fn cast(&self) -> Address<E>
fn cast(&self) -> Address<E>
Casts a Scalar
to an Address
.
This operation converts the scalar to a field element, and then attempts to recover the group element by treating the field element as an x-coordinate. The group element is then converted to an address.
To cast arbitrary scalars to addresses, use Scalar::cast_lossy
.
Source§impl<E: Environment, I0: IntegerType, I1: IntegerType> Cast<Integer<E, I1>> for Integer<E, I0>
impl<E: Environment, I0: IntegerType, I1: IntegerType> Cast<Integer<E, I1>> for Integer<E, I0>
Source§impl<E: Environment, I: IntegerType> Cast<Address<E>> for Integer<E, I>
impl<E: Environment, I: IntegerType> Cast<Address<E>> for Integer<E, I>
Source§fn cast(&self) -> Address<E>
fn cast(&self) -> Address<E>
Casts an Integer
to an Address
.
This operation converts the integer to a field element, and then attempts to recover the group element by treating the field element as an x-coordinate. The group element is then converted to an address.
To cast arbitrary integers to addresses, use Integer::cast_lossy
.