pub struct ProductTypeElement {
pub name: Option<Box<str>>,
pub algebraic_type: AlgebraicType,
}Expand description
A factor / element of a product type.
An element consist of an optional name and a 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 field / element.
As our type system is structural,
a type like { foo: U8 }, where foo: U8 is the ProductTypeElement,
is inequal to { bar: U8 }, although their algebraic_types (U8) match.
algebraic_type: AlgebraicTypeThe type of the element.
Only values of this type can be stored in the element.
Implementations§
Source§impl ProductTypeElement
impl ProductTypeElement
pub fn decode<'a>( bytes: &mut impl BufReader<'a>, ) -> Result<ProductTypeElement, DecodeError>
pub fn encode(&self, bytes: &mut impl BufWriter)
Source§impl ProductTypeElement
impl ProductTypeElement
Sourcepub const fn new(
algebraic_type: AlgebraicType,
name: Option<Box<str>>,
) -> ProductTypeElement
pub const fn new( algebraic_type: AlgebraicType, name: Option<Box<str>>, ) -> ProductTypeElement
Returns an element with the given name and algebraic_type.
Sourcepub fn new_named(
algebraic_type: AlgebraicType,
name: impl Into<Box<str>>,
) -> ProductTypeElement
pub fn new_named( algebraic_type: AlgebraicType, name: impl Into<Box<str>>, ) -> ProductTypeElement
Returns a named element with name and algebraic_type.
Trait Implementations§
Source§impl Clone for ProductTypeElement
impl Clone for ProductTypeElement
Source§fn clone(&self) -> ProductTypeElement
fn clone(&self) -> ProductTypeElement
Returns a duplicate 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 ProductTypeElement
impl Debug for ProductTypeElement
Source§impl<'de> Deserialize<'de> for ProductTypeElement
impl<'de> Deserialize<'de> for ProductTypeElement
Source§fn deserialize<D>(
deserializer: D,
) -> Result<ProductTypeElement, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<ProductTypeElement, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given
deserializer.Source§impl From<AlgebraicType> for ProductTypeElement
impl From<AlgebraicType> for ProductTypeElement
Source§fn from(value: AlgebraicType) -> ProductTypeElement
fn from(value: AlgebraicType) -> ProductTypeElement
Converts to this type from the input type.
Source§impl Hash for ProductTypeElement
impl Hash for ProductTypeElement
Source§impl MetaType for ProductTypeElement
impl MetaType for ProductTypeElement
Source§fn meta_type() -> AlgebraicType
fn meta_type() -> AlgebraicType
Returns the type structure of this type as an
AlgebraicType.Source§impl Ord for ProductTypeElement
impl Ord for ProductTypeElement
Source§fn cmp(&self, other: &ProductTypeElement) -> Ordering
fn cmp(&self, other: &ProductTypeElement) -> 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 ProductTypeElement
impl PartialEq for ProductTypeElement
Source§impl PartialOrd for ProductTypeElement
impl PartialOrd for ProductTypeElement
Source§impl Serialize for ProductTypeElement
impl Serialize for ProductTypeElement
Source§fn serialize<S>(
&self,
__serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
__serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize
self in the data format of S using the provided serializer.Source§impl Serialize for ProductTypeElement
impl Serialize for ProductTypeElement
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl SpacetimeType for ProductTypeElement
impl SpacetimeType for ProductTypeElement
Source§fn make_type<S>(__typespace: &mut S) -> AlgebraicTypewhere
S: TypespaceBuilder,
fn make_type<S>(__typespace: &mut S) -> AlgebraicTypewhere
S: TypespaceBuilder,
Returns an
AlgebraicType representing the type for Self in SATS
and in the typing context in typespace. This is used by the
automatic type registration system in Rust modules. Read moreimpl Eq for ProductTypeElement
impl StructuralPartialEq for ProductTypeElement
Auto Trait Implementations§
impl Freeze for ProductTypeElement
impl RefUnwindSafe for ProductTypeElement
impl Send for ProductTypeElement
impl Sync for ProductTypeElement
impl Unpin for ProductTypeElement
impl UnwindSafe for ProductTypeElement
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§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<(), Error>
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Formats the value using the SATN data format into the formatter
f.Source§fn fmt_psql(
&self,
f: &mut Formatter<'_>,
ty: &PsqlType<'_>,
) -> Result<(), Error>
fn fmt_psql( &self, f: &mut Formatter<'_>, ty: &PsqlType<'_>, ) -> Result<(), Error>
Formats the value using the postgres SATN(PsqlFormatter { f }, /* PsqlType */) 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.