Struct spacetimedb_sats::sum_type_variant::SumTypeVariant
source · pub struct SumTypeVariant {
pub name: Option<Box<str>>,
pub algebraic_type: AlgebraicType,
}
Expand description
A variant of a sum type.
NOTE: Each element has an implicit element tag based on its order. Uniquely identifies an element similarly to protobuf tags.
Fields§
§name: Option<Box<str>>
The name of the variant, if any.
algebraic_type: AlgebraicType
The type of the variant.
Unlike a language like Rust,
where we can have enum _ { V1 { foo: A, bar: B, .. }, .. }
,
the product within the variant V1
, i.e., { foo: A, bar: B, .. }
is separated out in SATS into a separate product type.
So we would express this as { V1({ foo: A, bar: B, .. }), .. }
.
Implementations§
source§impl SumTypeVariant
impl SumTypeVariant
Trait Implementations§
source§impl Clone for SumTypeVariant
impl Clone for SumTypeVariant
source§fn clone(&self) -> SumTypeVariant
fn clone(&self) -> SumTypeVariant
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for SumTypeVariant
impl Debug for SumTypeVariant
source§impl<'de> Deserialize<'de> for SumTypeVariant
impl<'de> Deserialize<'de> for SumTypeVariant
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given
deserializer
.source§impl From<AlgebraicType> for SumTypeVariant
impl From<AlgebraicType> for SumTypeVariant
source§fn from(algebraic_type: AlgebraicType) -> Self
fn from(algebraic_type: AlgebraicType) -> Self
Converts to this type from the input type.
source§impl Hash for SumTypeVariant
impl Hash for SumTypeVariant
source§impl MetaType for SumTypeVariant
impl MetaType for SumTypeVariant
source§fn meta_type() -> AlgebraicType
fn meta_type() -> AlgebraicType
Returns the type structure of this type as an
AlgebraicType
.source§impl Ord for SumTypeVariant
impl Ord for SumTypeVariant
source§fn cmp(&self, other: &SumTypeVariant) -> Ordering
fn cmp(&self, other: &SumTypeVariant) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for SumTypeVariant
impl PartialEq for SumTypeVariant
source§impl PartialOrd for SumTypeVariant
impl PartialOrd for SumTypeVariant
source§impl Serialize for SumTypeVariant
impl Serialize for SumTypeVariant
impl Eq for SumTypeVariant
impl StructuralPartialEq for SumTypeVariant
Auto Trait Implementations§
impl Freeze for SumTypeVariant
impl RefUnwindSafe for SumTypeVariant
impl Send for SumTypeVariant
impl Sync for SumTypeVariant
impl Unpin for SumTypeVariant
impl UnwindSafe for SumTypeVariant
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moresource§impl<T> Satn for T
impl<T> Satn for T
source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
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<'_>, ty: &ProductType) -> Result
fn fmt_psql(&self, f: &mut Formatter<'_>, ty: &ProductType) -> Result
Formats the value using the postgres SATN(SatnFormatter { f }, /* AlgebraicType */) formatter
f
.source§fn to_satn(&self) -> String
fn to_satn(&self) -> String
Formats the value using the SATN data format into the returned
String
.source§fn to_satn_pretty(&self) -> String
fn to_satn_pretty(&self) -> String
Pretty prints the value using the SATN data format into the returned
String
.