Skip to main content

TypeDescriptor

Enum TypeDescriptor 

Source
pub enum TypeDescriptor {
Show 30 variants Boolean, Field, JubjubScalar, Secp256k1Base, Secp256k1Scalar, Secp256r1Base, Secp256r1Scalar, Curve25519Base, Curve25519Scalar, JubjubPoint, Secp256k1Point, Secp256r1Point, Curve25519Point, Unknown, Uint { maxval: IntLit, alignment_bytes: Option<u32>, }, Bytes { length: u32, }, Opaque { ts_type: String, }, Vector { length: u32, elt_type: Box<TypeDescriptor>, }, Tuple { types: Vec<TypeDescriptor>, }, Struct { name: String, elements: Vec<StructField>, }, Enum { name: String, elements: Vec<String>, }, Alias { name: String, of: Box<TypeDescriptor>, }, Contract { name: String, circuits: Vec<ContractCircuitSig>, }, Cell { of: Box<TypeDescriptor>, }, Counter, Map { key: Box<TypeDescriptor>, value: Box<TypeDescriptor>, }, Set { of: Box<TypeDescriptor>, }, List { of: Box<TypeDescriptor>, }, MerkleTree { depth: IntLit, of: Box<TypeDescriptor>, }, HistoricMerkleTree { depth: IntLit, of: Box<TypeDescriptor>, },
}

Variants§

§

Boolean

§

Field

§

JubjubScalar

Scalar field of the Jubjub curve. Shares Field’s single-atom alignment and encoding; only the valid range differs (JUBJUB_SCALAR_MODULUS - 1). compactc 0.33 promoted this from an opaque builtin to a standard-library type.

§

Secp256k1Base

Base field of secp256k1. Two atoms — bytes:24 holding the low 192 bits, bytes:8 the high 64 — with the value rotated by one (0 maps to the modulus-1, everything else to v - 1) because that is what the ZKIR representation stores.

§

Secp256k1Scalar

Scalar field of secp256k1. Same two-atom layout and rotation as TypeDescriptor::Secp256k1Base, different modulus.

§

Secp256r1Base

Base field of secp256r1 (P-256). Same two-atom layout and rotation as TypeDescriptor::Secp256k1Base.

§

Secp256r1Scalar

Scalar field of secp256r1. Same layout as TypeDescriptor::Secp256k1Base.

§

Curve25519Base

Base field of Curve25519. Same layout as TypeDescriptor::Secp256k1Base.

§

Curve25519Scalar

Scalar field of Curve25519. Two atoms split at bit 204 rather than 192 — bytes:26 then bytes:7 — with the same rotation.

§

JubjubPoint

Point on the Jubjub curve: two native field atoms, x then y.

§

Secp256k1Point

Point on secp256k1: x and y each as a Secp256k1Base pair, then a native field atom holding the identity flag.

§

Secp256r1Point

Point on secp256r1, laid out as TypeDescriptor::Secp256k1Point over Secp256r1Base.

§

Curve25519Point

Point on Curve25519 in Edwards form: x then y, each a Curve25519Base pair. No identity flag; the identity is (0, 1).

§

Unknown

Element type of an empty vector literal ([]). The compact fork emits {"type-name": "Unknown"} here, mirroring the TypeScript emitter’s format-type. Never reaches the descriptors map — only appears inline in circuit bodies.

§

Uint

Fields

§maxval: IntLit
§alignment_bytes: Option<u32>
§

Bytes

Fields

§length: u32
§

Opaque

Fields

§ts_type: String
§

Vector

Fields

§length: u32
§

Tuple

Fields

§

Struct

Fields

§name: String
§elements: Vec<StructField>
§

Enum

Fields

§name: String
§elements: Vec<String>
§

Alias

Fields

§name: String
§

Contract

Fields

§name: String
§

Cell

§

Counter

§

Map

§

Set

§

List

§

MerkleTree

Fields

§depth: IntLit
§

HistoricMerkleTree

Fields

§depth: IntLit

Implementations§

Source§

impl TypeDescriptor

Source

pub fn contract_address() -> Self

The standard library’s ContractAddress struct. A value of a contract type is the address of a contract implementing it, and compactc stores and passes it as this struct (subst-tcontract in print-typescript.ss).

Trait Implementations§

Source§

impl Clone for TypeDescriptor

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TypeDescriptor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TypeDescriptor

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for TypeDescriptor

A type as a person reads it, in Compact’s spelling: Uint<0..255>, Bytes<32>, Map<Field, Boolean>, Struct<Point>.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for TypeDescriptor

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for TypeDescriptor

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TypeDescriptor

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.