pub enum TypeSignature {
    NoType,
    IntType,
    UIntType,
    BoolType,
    SequenceType(SequenceSubtype),
    PrincipalType,
    TupleType(TupleTypeSignature),
    OptionalType(Box<TypeSignature>),
    ResponseType(Box<(TypeSignature, TypeSignature)>),
    TraitReferenceType(TraitIdentifier),
}

Variants

NoType

IntType

UIntType

BoolType

SequenceType(SequenceSubtype)

PrincipalType

TupleType(TupleTypeSignature)

OptionalType(Box<TypeSignature>)

ResponseType(Box<(TypeSignature, TypeSignature)>)

TraitReferenceType(TraitIdentifier)

Implementations

If one of the types is a NoType, return Ok(the other type), otherwise return least_supertype(a, b)

This function returns the most-restrictive type that admits both A and B (something like a least common supertype), or Errors if no such type exists. On error, it throws NoSuperType(A,B), unless a constructor error’ed – in which case, it throws the constructor’s error.

For two Tuples: least_supertype(A, B) := (tuple \for_each(key k) least_supertype(type_a_k, type_b_k)) For two Lists: least_supertype(A, B) := (list max_len: max(max_len A, max_len B), entry: least_supertype(entry_a, entry_b)) if max_len A | max_len B is 0: entry := Non-empty list entry For two responses: least_supertype(A, B) := (response least_supertype(ok_a, ok_b), least_supertype(err_a, err_b)) if any entries are NoType, use the other type’s entry For two options: least_supertype(A, B) := (option least_supertype(some_a, some_b)) if some_a | some_b is NoType, use the other type’s entry. For buffers: least_supertype(A, B) := (buff len: max(len A, len B)) For ints, uints, principals, bools: least_supertype(A, B) := if A != B, error, else A

Parsing functions.

These implement the size calculations in TypeSignatures in constructors of TypeSignatures, only .inner_size() may be called. .inner_size is a failable method to compute the size of the type signature, Failures indicate that a type signature represents too large of a value. TypeSignature constructors will fail instead of constructing such a type. because of this, the public interface to size is infallible.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more