Struct spacetimedb_sats::sum_value::SumValue
source · pub struct SumValue {
pub tag: u8,
pub value: Box<AlgebraicValue>,
}
Expand description
A value of a sum type chosing a specific variant of the type.
Fields§
§tag: u8
A tag representing the choice of one variant of the sum type’s variants.
value: Box<AlgebraicValue>
Given a variant Var(Ty)
in a sum type { Var(Ty), ... }
,
this provides the value
for Ty
.
Implementations§
source§impl SumValue
impl SumValue
sourcepub fn decode<'a>(
ty: &<Self as Value>::Type,
bytes: &mut impl BufReader<'a>,
) -> Result<Self, DecodeError>
pub fn decode<'a>( ty: &<Self as Value>::Type, bytes: &mut impl BufReader<'a>, ) -> Result<Self, DecodeError>
Decode a value from bytes
typed at ty
.
sourcepub fn decode_smallvec<'a>(
ty: &<Self as Value>::Type,
bytes: &mut impl BufReader<'a>,
) -> Result<SmallVec<[Self; 1]>, DecodeError>
pub fn decode_smallvec<'a>( ty: &<Self as Value>::Type, bytes: &mut impl BufReader<'a>, ) -> Result<SmallVec<[Self; 1]>, DecodeError>
Decode a vector of values from bytes
with each value typed at ty
.
pub fn encode(&self, bytes: &mut impl BufWriter)
Trait Implementations§
source§impl From<SumValue> for AlgebraicValue
impl From<SumValue> for AlgebraicValue
source§fn from(original: SumValue) -> AlgebraicValue
fn from(original: SumValue) -> AlgebraicValue
Converts to this type from the input type.
source§impl Ord for SumValue
impl Ord for SumValue
source§impl PartialOrd for SumValue
impl PartialOrd for SumValue
impl Eq for SumValue
impl StructuralPartialEq for SumValue
Auto Trait Implementations§
impl Freeze for SumValue
impl RefUnwindSafe for SumValue
impl Send for SumValue
impl Sync for SumValue
impl Unpin for SumValue
impl UnwindSafe for SumValue
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
.