Skip to content

supertype in subtype#133

Closed
ytanimura wants to merge 2 commits intomasterfrom
ane_in_struct2
Closed

supertype in subtype#133
ytanimura wants to merge 2 commits intomasterfrom
ane_in_struct2

Conversation

@ytanimura
Copy link
Contributor

Close #126

@ytanimura ytanimura mentioned this pull request Oct 30, 2021
@ytanimura
Copy link
Contributor Author

Summary of changes

  • Adds supertype into subtype as a field.
pub struct Cat {
    pub pet: Pet,
    pub tail_color: String,
}
  • Adds table both of SuperType and SuperTypeAny.
pub struct Tables {
    pet: HashMap<u64, as_holder!(Pet)>,
    pet_any: HashMap<u64, as_holder!(PetAny)>,
    cat: HashMap<u64, as_holder!(Cat)>,
}

The secondary change perhaps superfluity...

Original EXPRESS for example:

SCHEMA pets;

ENTITY pet;
	name: STRING;
END_ENTITY;

ENTITY cat SUBTYPE OF (pet);
	tail_color: STRING;
END_ENTITY;

END_SCHEMA;

@ytanimura ytanimura requested a review from termoshtt October 30, 2021 06:59
@termoshtt
Copy link
Contributor

Adds table both of SuperType and SuperTypeAny.

This should not be added. In original design, impl EntityTable<XxxAny> for Tables { ... } should be used to get owned XxxAny type from Tables.

This impl will be generated by ruststep_derive::select::Input::impl_entity_table, but it seems ruststep::ap201 lacks it (this must be a bug).

@termoshtt
Copy link
Contributor

This impl will be generated by ruststep_derive::select::Input::impl_entity_table, but it seems ruststep::ap201 lacks it (this must be a bug).

I will fix this in #135. For this PR,

Adds table both of SuperType and SuperTypeAny.

please remove this part, and focus only on the first "Adds supertype into subtype as a field." part.

@ytanimura
Copy link
Contributor Author

It has been modified to conform to the source code https://github.com/ricosjp/ruststep/blob/master/ruststep/tests/any_deserialize.rs .

@ytanimura ytanimura mentioned this pull request Dec 1, 2021
@ytanimura
Copy link
Contributor Author

Now, exprc is refactored #165. Rebuilt the pull request #166 again.

@ytanimura ytanimura closed this Dec 1, 2021
@ytanimura ytanimura deleted the ane_in_struct2 branch December 27, 2021 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sub type did not have super type as struct

2 participants