Struct spacetimedb_sats::WithTypespace
source · pub struct WithTypespace<'a, T: ?Sized> { /* private fields */ }
Expand description
Adds a Typespace
context atop of a borrowed type.
Implementations§
source§impl<'a> WithTypespace<'a, ProductType>
impl<'a> WithTypespace<'a, ProductType>
pub fn elements(&self) -> ElementsWithTypespace<'a>
pub fn with_values<I: IntoIterator<Item = &'a AlgebraicValue>>(
&self,
vals: I,
) -> ElementValuesWithType<'a, I::IntoIter> ⓘwhere
I::IntoIter: ExactSizeIterator,
source§impl<'a> WithTypespace<'a, ProductTypeElement>
impl<'a> WithTypespace<'a, ProductTypeElement>
pub fn algebraic_type(&self) -> WithTypespace<'a, AlgebraicType>
source§impl<T: ResolveRefs> WithTypespace<'_, T>
impl<T: ResolveRefs> WithTypespace<'_, T>
pub fn resolve_refs(self) -> Option<T::Output>
source§impl<'a, T: ?Sized> WithTypespace<'a, T>
impl<'a, T: ?Sized> WithTypespace<'a, T>
sourcepub const fn new(typespace: &'a Typespace, ty: &'a T) -> Self
pub const fn new(typespace: &'a Typespace, ty: &'a T) -> Self
Wraps ty
in a context combined with the typespace
.
sourcepub fn with<'b, U>(&self, ty: &'b U) -> WithTypespace<'b, U>where
'a: 'b,
pub fn with<'b, U>(&self, ty: &'b U) -> WithTypespace<'b, U>where
'a: 'b,
Reuses the typespace we already have and returns ty: U
wrapped with it.
sourcepub fn with_value<'b, V: Value<Type = T>>(
&self,
val: &'b V,
) -> ValueWithType<'b, V>where
'a: 'b,
pub fn with_value<'b, V: Value<Type = T>>(
&self,
val: &'b V,
) -> ValueWithType<'b, V>where
'a: 'b,
Wraps val
with the type and typespace context in self
.
sourcepub fn resolve(&self, r: AlgebraicTypeRef) -> WithTypespace<'a, AlgebraicType>
pub fn resolve(&self, r: AlgebraicTypeRef) -> WithTypespace<'a, AlgebraicType>
Returns the AlgebraicType
that r
resolves to in the context of our Typespace
.
Panics if r
is not known by our Typespace
.
Trait Implementations§
source§impl<T: ?Sized> Clone for WithTypespace<'_, T>
impl<T: ?Sized> Clone for WithTypespace<'_, T>
source§impl<'de> DeserializeSeed<'de> for WithTypespace<'_, AlgebraicType>
impl<'de> DeserializeSeed<'de> for WithTypespace<'_, AlgebraicType>
source§type Output = AlgebraicValue
type Output = AlgebraicValue
The type produced by using this seed.
source§fn deserialize<D: Deserializer<'de>>(
self,
de: D,
) -> Result<Self::Output, D::Error>
fn deserialize<D: Deserializer<'de>>( self, de: D, ) -> Result<Self::Output, D::Error>
Equivalent to the more common
Deserialize::deserialize
associated function,
except with some initial piece of data (the seed self
) passed in.source§impl<'de> DeserializeSeed<'de> for WithTypespace<'_, ArrayType>
impl<'de> DeserializeSeed<'de> for WithTypespace<'_, ArrayType>
source§type Output = ArrayValue
type Output = ArrayValue
The type produced by using this seed.
source§fn deserialize<D: Deserializer<'de>>(
self,
deserializer: D,
) -> Result<Self::Output, D::Error>
fn deserialize<D: Deserializer<'de>>( self, deserializer: D, ) -> Result<Self::Output, D::Error>
Equivalent to the more common
Deserialize::deserialize
associated function,
except with some initial piece of data (the seed self
) passed in.source§impl<'de> DeserializeSeed<'de> for WithTypespace<'_, MapType>
impl<'de> DeserializeSeed<'de> for WithTypespace<'_, MapType>
source§type Output = BTreeMap<AlgebraicValue, AlgebraicValue>
type Output = BTreeMap<AlgebraicValue, AlgebraicValue>
The type produced by using this seed.
source§fn deserialize<D: Deserializer<'de>>(
self,
deserializer: D,
) -> Result<Self::Output, D::Error>
fn deserialize<D: Deserializer<'de>>( self, deserializer: D, ) -> Result<Self::Output, D::Error>
Equivalent to the more common
Deserialize::deserialize
associated function,
except with some initial piece of data (the seed self
) passed in.source§impl<'de> DeserializeSeed<'de> for WithTypespace<'_, ProductType>
impl<'de> DeserializeSeed<'de> for WithTypespace<'_, ProductType>
source§type Output = ProductValue
type Output = ProductValue
The type produced by using this seed.
source§fn deserialize<D: Deserializer<'de>>(
self,
deserializer: D,
) -> Result<Self::Output, D::Error>
fn deserialize<D: Deserializer<'de>>( self, deserializer: D, ) -> Result<Self::Output, D::Error>
Equivalent to the more common
Deserialize::deserialize
associated function,
except with some initial piece of data (the seed self
) passed in.source§impl<'de> DeserializeSeed<'de> for WithTypespace<'_, SumType>
impl<'de> DeserializeSeed<'de> for WithTypespace<'_, SumType>
source§fn deserialize<D: Deserializer<'de>>(
self,
deserializer: D,
) -> Result<Self::Output, D::Error>
fn deserialize<D: Deserializer<'de>>( self, deserializer: D, ) -> Result<Self::Output, D::Error>
Equivalent to the more common
Deserialize::deserialize
associated function,
except with some initial piece of data (the seed self
) passed in.source§impl<'a> IntoIterator for WithTypespace<'a, ProductType>
impl<'a> IntoIterator for WithTypespace<'a, ProductType>
source§type Item = WithTypespace<'a, ProductTypeElement>
type Item = WithTypespace<'a, ProductTypeElement>
The type of the elements being iterated over.
source§type IntoIter = IterWithTypespace<'a, Iter<'a, ProductTypeElement>>
type IntoIter = IterWithTypespace<'a, Iter<'a, ProductTypeElement>>
Which kind of iterator are we turning this into?
source§impl<'de> ProductVisitor<'de> for WithTypespace<'_, ProductType>
impl<'de> ProductVisitor<'de> for WithTypespace<'_, ProductType>
source§type Output = ProductValue
type Output = ProductValue
The resulting product.
source§fn product_name(&self) -> Option<&str>
fn product_name(&self) -> Option<&str>
Returns the name of the product, if any.
source§fn product_len(&self) -> usize
fn product_len(&self) -> usize
Returns the length of the product.
source§fn visit_seq_product<A: SeqProductAccess<'de>>(
self,
tup: A,
) -> Result<Self::Output, A::Error>
fn visit_seq_product<A: SeqProductAccess<'de>>( self, tup: A, ) -> Result<Self::Output, A::Error>
The input contains an unnamed product.
source§fn visit_named_product<A: NamedProductAccess<'de>>(
self,
tup: A,
) -> Result<Self::Output, A::Error>
fn visit_named_product<A: NamedProductAccess<'de>>( self, tup: A, ) -> Result<Self::Output, A::Error>
The input contains a named product.
source§fn product_kind(&self) -> ProductKind
fn product_kind(&self) -> ProductKind
Returns the kind of the product.
source§impl<'de> SumVisitor<'de> for WithTypespace<'_, SumType>
impl<'de> SumVisitor<'de> for WithTypespace<'_, SumType>
source§impl VariantVisitor for WithTypespace<'_, SumType>
impl VariantVisitor for WithTypespace<'_, SumType>
impl<T: ?Sized> Copy for WithTypespace<'_, T>
Auto Trait Implementations§
impl<'a, T> Freeze for WithTypespace<'a, T>where
T: ?Sized,
impl<'a, T> RefUnwindSafe for WithTypespace<'a, T>where
T: RefUnwindSafe + ?Sized,
impl<'a, T> Send for WithTypespace<'a, T>
impl<'a, T> Sync for WithTypespace<'a, T>
impl<'a, T> Unpin for WithTypespace<'a, T>where
T: ?Sized,
impl<'a, T> UnwindSafe for WithTypespace<'a, T>where
T: RefUnwindSafe + ?Sized,
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 more