Enum spacetimedb_sats::builtin_type::BuiltinType

source ·
pub enum BuiltinType {
Show 16 variants Bool, I8, U8, I16, U16, I32, U32, I64, U64, I128, U128, F32, F64, String, Array(ArrayType), Map(Box<MapType>),
}
Expand description

Represents the built-in types in SATS.

Some of these types are nominal in our otherwise structural type system.

Variants§

§

Bool

The bool type. Values BuiltinValue::Bool(b) will have this type.

§

I8

The I8 type. Values BuiltinValue::I8(v) will have this type.

§

U8

The U8 type. Values BuiltinValue::U8(v) will have this type.

§

I16

The I16 type. Values BuiltinValue::I16(v) will have this type.

§

U16

The U16 type. Values BuiltinValue::U16(v) will have this type.

§

I32

The I32 type. Values BuiltinValue::I32(v) will have this type.

§

U32

The U32 type. Values BuiltinValue::U32(v) will have this type.

§

I64

The I64 type. Values BuiltinValue::I64(v) will have this type.

§

U64

The U64 type. Values BuiltinValue::U64(v) will have this type.

§

I128

The I128 type. Values BuiltinValue::I128(v) will have this type.

§

U128

The U128 type. Values BuiltinValue::U128(v) will have this type.

§

F32

The F32 type. Values BuiltinValue::F32(v) will have this type.

§

F64

The F64 type. Values BuiltinValue::F64(v) will have this type.

§

String

The UTF-8 encoded String type. Values BuiltinValue::String(s) will have this type.

This type exists for convenience and because it is easy to just use Rust’s String (UTF-8) as opposed to rolling your own equivalent byte-array based UTF-8 encoding.

§

Array(ArrayType)

The type of array values where elements are of a base type elem_ty. Values BuiltinValue::Array(array) will have this type.

§

Map(Box<MapType>)

The type of map values consisting of a key type key_ty and value ty. Values BuiltinValue::Map(map) will have this type. The order of entries in a map value is observable.

Implementations§

source§

impl BuiltinType

source

pub fn is_bool(&self) -> bool

Returns true if this is a BuiltinType::Bool, otherwise false

source

pub fn is_i8(&self) -> bool

Returns true if this is a BuiltinType::I8, otherwise false

source

pub fn is_u8(&self) -> bool

Returns true if this is a BuiltinType::U8, otherwise false

source

pub fn is_i16(&self) -> bool

Returns true if this is a BuiltinType::I16, otherwise false

source

pub fn is_u16(&self) -> bool

Returns true if this is a BuiltinType::U16, otherwise false

source

pub fn is_i32(&self) -> bool

Returns true if this is a BuiltinType::I32, otherwise false

source

pub fn is_u32(&self) -> bool

Returns true if this is a BuiltinType::U32, otherwise false

source

pub fn is_i64(&self) -> bool

Returns true if this is a BuiltinType::I64, otherwise false

source

pub fn is_u64(&self) -> bool

Returns true if this is a BuiltinType::U64, otherwise false

source

pub fn is_i128(&self) -> bool

Returns true if this is a BuiltinType::I128, otherwise false

source

pub fn is_u128(&self) -> bool

Returns true if this is a BuiltinType::U128, otherwise false

source

pub fn is_f32(&self) -> bool

Returns true if this is a BuiltinType::F32, otherwise false

source

pub fn is_f64(&self) -> bool

Returns true if this is a BuiltinType::F64, otherwise false

source

pub fn is_string(&self) -> bool

Returns true if this is a BuiltinType::String, otherwise false

source

pub fn is_array(&self) -> bool

Returns true if this is a BuiltinType::Array, otherwise false

source

pub fn as_array_mut(&mut self) -> Option<&mut ArrayType>

Optionally returns mutable references to the inner fields if this is a BuiltinType::Array, otherwise None

source

pub fn as_array(&self) -> Option<&ArrayType>

Optionally returns references to the inner fields if this is a BuiltinType::Array, otherwise None

source

pub fn into_array(self) -> Result<ArrayType, Self>

Returns the inner fields if this is a BuiltinType::Array, otherwise returns back the enum in the Err case of the result

source

pub fn is_map(&self) -> bool

Returns true if this is a BuiltinType::Map, otherwise false

source

pub fn as_map_mut(&mut self) -> Option<&mut Box<MapType>>

Optionally returns mutable references to the inner fields if this is a BuiltinType::Map, otherwise None

source

pub fn as_map(&self) -> Option<&Box<MapType>>

Optionally returns references to the inner fields if this is a BuiltinType::Map, otherwise None

source

pub fn into_map(self) -> Result<Box<MapType>, Self>

Returns the inner fields if this is a BuiltinType::Map, otherwise returns back the enum in the Err case of the result

source§

impl BuiltinType

Trait Implementations§

source§

impl Clone for BuiltinType

source§

fn clone(&self) -> BuiltinType

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for BuiltinType

source§

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

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

impl<'de> Deserialize<'de> for BuiltinType

source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given deserializer.
source§

impl From<BuiltinType> for AlgebraicType

source§

fn from(original: BuiltinType) -> AlgebraicType

Converts to this type from the input type.
source§

impl Hash for BuiltinType

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl MetaType for BuiltinType

source§

fn meta_type() -> AlgebraicType

Returns the type structure of this type as an AlgebraicType.
source§

impl Ord for BuiltinType

source§

fn cmp(&self, other: &BuiltinType) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for BuiltinType

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for BuiltinType

source§

fn partial_cmp(&self, other: &BuiltinType) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for BuiltinType

source§

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

Serialize self in the data format of S using the provided serializer.
source§

impl Eq for BuiltinType

source§

impl StructuralPartialEq for BuiltinType

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> Satn for T
where T: Serialize + ?Sized,

source§

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

Formats the value using the SATN data format into the formatter f.
source§

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

Formats the value using the postgres SATN data format into the formatter f.
source§

fn to_satn(&self) -> String

Formats the value using the SATN data format into the returned String.
source§

fn to_satn_pretty(&self) -> String

Pretty prints the value using the SATN data format into the returned String.
source§

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

§

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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
source§

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