Enum clarity_repl::clarity::types::signatures::TypeSignature[][src]

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
OptionalType(Box<TypeSignature>)
TraitReferenceType(TraitIdentifier)

Implementations

impl TypeSignature[src]

pub fn new_option(
    inner_type: TypeSignature
) -> Result<TypeSignature, CheckErrors>
[src]

pub fn new_response(
    ok_type: TypeSignature,
    err_type: TypeSignature
) -> Result<TypeSignature, CheckErrors>
[src]

pub fn is_response_type(&self) -> bool[src]

pub fn is_no_type(&self) -> bool[src]

pub fn admits(&self, x: &Value) -> bool[src]

pub fn admits_type(&self, other: &TypeSignature) -> bool[src]

impl TypeSignature[src]

pub fn empty_buffer() -> TypeSignature[src]

pub fn min_buffer() -> TypeSignature[src]

pub fn min_string_ascii() -> TypeSignature[src]

pub fn min_string_utf8() -> TypeSignature[src]

pub fn max_buffer() -> TypeSignature[src]

pub fn factor_out_no_type(
    a: &TypeSignature,
    b: &TypeSignature
) -> Result<TypeSignature, CheckErrors>
[src]

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

pub fn least_supertype(
    a: &TypeSignature,
    b: &TypeSignature
) -> Result<TypeSignature, CheckErrors>
[src]

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

pub fn list_of(
    item_type: TypeSignature,
    max_len: u32
) -> Result<TypeSignature, CheckErrors>
[src]

pub fn empty_list() -> ListTypeData[src]

pub fn type_of(x: &Value) -> TypeSignature[src]

pub fn construct_parent_list_type(
    args: &[Value]
) -> Result<ListTypeData, CheckErrors>
[src]

pub fn parent_list_type(
    children: &[TypeSignature]
) -> Result<ListTypeData, CheckErrors>
[src]

impl TypeSignature[src]

Parsing functions.

impl TypeSignature[src]

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.

pub fn depth(&self) -> u8[src]

pub fn size(&self) -> u32[src]

pub fn type_size(&self) -> Result<u32, CheckErrors>[src]

Trait Implementations

impl Clone for TypeSignature[src]

impl Debug for TypeSignature[src]

impl<'de> Deserialize<'de> for TypeSignature[src]

impl Display for TypeSignature[src]

impl Eq for TypeSignature[src]

impl From<ListTypeData> for TypeSignature[src]

impl From<TupleTypeSignature> for TypeSignature[src]

impl PartialEq<TypeSignature> for TypeSignature[src]

impl Serialize for TypeSignature[src]

impl StructuralEq for TypeSignature[src]

impl StructuralPartialEq for TypeSignature[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,