Enum clarity_repl::clarity::types::signatures::TypeSignature [−][src]
Variants
SequenceType(SequenceSubtype)
TupleType(TupleTypeSignature)
OptionalType(Box<TypeSignature>)
ResponseType(Box<(TypeSignature, TypeSignature)>)
TraitReferenceType(TraitIdentifier)
Implementations
impl TypeSignature
[src]
pub fn new_option(
inner_type: TypeSignature
) -> Result<TypeSignature, CheckErrors>
[src]
inner_type: TypeSignature
) -> Result<TypeSignature, CheckErrors>
pub fn new_response(
ok_type: TypeSignature,
err_type: TypeSignature
) -> Result<TypeSignature, CheckErrors>
[src]
ok_type: TypeSignature,
err_type: TypeSignature
) -> Result<TypeSignature, CheckErrors>
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]
a: &TypeSignature,
b: &TypeSignature
) -> Result<TypeSignature, CheckErrors>
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]
a: &TypeSignature,
b: &TypeSignature
) -> Result<TypeSignature, CheckErrors>
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]
item_type: TypeSignature,
max_len: u32
) -> Result<TypeSignature, CheckErrors>
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]
args: &[Value]
) -> Result<ListTypeData, CheckErrors>
pub fn parent_list_type(
children: &[TypeSignature]
) -> Result<ListTypeData, CheckErrors>
[src]
children: &[TypeSignature]
) -> Result<ListTypeData, CheckErrors>
impl TypeSignature
[src]
Parsing functions.
pub fn parse_response_type_repr<A: CostTracker>(
type_args: &[SymbolicExpression],
accounting: &mut A
) -> Result<TypeSignature, CheckErrors>
[src]
type_args: &[SymbolicExpression],
accounting: &mut A
) -> Result<TypeSignature, CheckErrors>
pub fn parse_type_repr<A: CostTracker>(
x: &SymbolicExpression,
accounting: &mut A
) -> Result<TypeSignature, CheckErrors>
[src]
x: &SymbolicExpression,
accounting: &mut A
) -> Result<TypeSignature, CheckErrors>
pub fn parse_trait_type_repr<A: CostTracker>(
type_args: &[SymbolicExpression],
accounting: &mut A
) -> Result<BTreeMap<ClarityName, FunctionSignature>, CheckErrors>
[src]
type_args: &[SymbolicExpression],
accounting: &mut A
) -> Result<BTreeMap<ClarityName, FunctionSignature>, CheckErrors>
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]
fn clone(&self) -> TypeSignature
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for TypeSignature
[src]
impl<'de> Deserialize<'de> for TypeSignature
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Display for TypeSignature
[src]
impl Eq for TypeSignature
[src]
impl From<ListTypeData> for TypeSignature
[src]
fn from(data: ListTypeData) -> Self
[src]
impl From<TupleTypeSignature> for TypeSignature
[src]
fn from(data: TupleTypeSignature) -> Self
[src]
impl PartialEq<TypeSignature> for TypeSignature
[src]
fn eq(&self, other: &TypeSignature) -> bool
[src]
fn ne(&self, other: &TypeSignature) -> bool
[src]
impl Serialize for TypeSignature
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for TypeSignature
[src]
impl StructuralPartialEq for TypeSignature
[src]
Auto Trait Implementations
impl RefUnwindSafe for TypeSignature
impl Send for TypeSignature
impl Sync for TypeSignature
impl Unpin for TypeSignature
impl UnwindSafe for TypeSignature
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,