Enum clarity_repl::clarity::types::Value[][src]

pub enum Value {
    Int(i128),
    UInt(u128),
    Bool(bool),
    Sequence(SequenceData),
    Principal(PrincipalData),
    Tuple(TupleData),
    Optional(OptionalData),
    Response(ResponseData),
}

Variants

Int(i128)
UInt(u128)
Bool(bool)
Sequence(SequenceData)
Principal(PrincipalData)
Tuple(TupleData)
Optional(OptionalData)
Response(ResponseData)

Implementations

impl Value[src]

pub fn deserialize_read<R: Read>(
    r: &mut R,
    expected_type: Option<&TypeSignature>
) -> Result<Value, SerializationError>
[src]

pub fn serialize_write<W: Write>(&self, w: &mut W) -> Result<()>[src]

pub fn try_deserialize_bytes(
    bytes: &Vec<u8>,
    expected: &TypeSignature
) -> Result<Value, SerializationError>
[src]

This function attempts to deserialize a hex string into a Clarity Value. The expected_type parameter determines whether or not the deserializer should expect (and enforce) a particular type. ClarityDB uses this to ensure that lists, tuples, etc. loaded from the database have their max-length and other type information set by the type declarations in the contract. If passed None, the deserializer will construct the values as if they were literals in the contract, e.g., list max length = the length of the list.

pub fn try_deserialize_hex(
    hex: &str,
    expected: &TypeSignature
) -> Result<Value, SerializationError>
[src]

pub fn try_deserialize_bytes_untyped(
    bytes: &Vec<u8>
) -> Result<Value, SerializationError>
[src]

pub fn try_deserialize_hex_untyped(
    hex: &str
) -> Result<Value, SerializationError>
[src]

pub fn deserialize(hex: &str, expected: &TypeSignature) -> Self[src]

impl Value[src]

pub fn some(data: Value) -> Result<Value>[src]

pub fn none() -> Value[src]

pub fn okay_true() -> Value[src]

pub fn err_uint(ecode: u128) -> Value[src]

pub fn err_none() -> Value[src]

pub fn okay(data: Value) -> Result<Value>[src]

pub fn error(data: Value) -> Result<Value>[src]

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

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

pub fn list_with_type(
    list_data: Vec<Value>,
    expected_type: ListTypeData
) -> Result<Value>
[src]

Invariant: the supplied Values have already been “checked”, i.e., it’s a valid Value object this invariant is enforced through the Value constructors, each of which checks to ensure that any typing data is correct.

pub fn list_from(list_data: Vec<Value>) -> Result<Value>[src]

pub fn buff_from(buff_data: Vec<u8>) -> Result<Value>[src]

pub fn buff_from_byte(byte: u8) -> Value[src]

pub fn string_ascii_from_bytes(bytes: Vec<u8>) -> Result<Value>[src]

pub fn string_utf8_from_string_utf8_literal(
    tokenized_str: String
) -> Result<Value>
[src]

pub fn string_utf8_from_bytes(bytes: Vec<u8>) -> Result<Value>[src]

pub fn expect_ascii(self) -> String[src]

pub fn expect_u128(self) -> u128[src]

pub fn expect_i128(self) -> i128[src]

pub fn expect_buff(self, sz: usize) -> Vec<u8>[src]

pub fn expect_list(self) -> Vec<Value>[src]

pub fn expect_buff_padded(self, sz: usize, pad: u8) -> Vec<u8>[src]

pub fn expect_bool(self) -> bool[src]

pub fn expect_tuple(self) -> TupleData[src]

pub fn expect_optional(self) -> Option<Value>[src]

pub fn expect_principal(self) -> PrincipalData[src]

pub fn expect_result(self) -> Result<Value, Value>[src]

pub fn expect_result_ok(self) -> Value[src]

pub fn expect_result_err(self) -> Value[src]

Trait Implementations

impl ClarityDeserializable<Value> for Value[src]

impl ClaritySerializable for Value[src]

impl Clone for Value[src]

impl Debug for Value[src]

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

impl Display for Value[src]

impl Eq for Value[src]

impl From<&'_ Value> for TypePrefix[src]

impl From<PrincipalData> for Value[src]

impl From<QualifiedContractIdentifier> for Value[src]

impl From<StandardPrincipalData> for Value[src]

impl From<TupleData> for Value[src]

impl Into<Value> for ShortReturnType[src]

impl MemoryConsumer for Value[src]

impl PartialEq<Value> for Value[src]

impl SequencedValue<Value> for ListData[src]

impl Serialize for Value[src]

impl StructuralEq for Value[src]

impl StructuralPartialEq for Value[src]

Auto Trait Implementations

impl RefUnwindSafe for Value

impl Send for Value

impl Sync for Value

impl Unpin for Value

impl UnwindSafe for Value

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>,