Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Derive TypeInfo for fields with associated types without bounds #20

Merged
merged 24 commits into from
Dec 14, 2020

Conversation

ascjones
Copy link
Contributor

@ascjones ascjones commented Sep 8, 2020

WIP, copied and amended trait_bounds from parity_scale_codec. Works but needs refactoring and documenting.

e.g.

trait Types {
	type A; // doesn't require TypeInfo trait bound
}
#[derive(TypeInfo)]
struct Assoc<T: Types> {
	a: T::A 
}

#[derive(TypeInfo)]
enum ConcreteTypes {}
impl Types for ConcreteTypes {
	type A = bool;
}

This generates a TypeInfo impl with bounds on the associated types i.e.

impl<T> for Assoc<T> where T: Types, T::A: TypeInfo

@ascjones ascjones changed the title Support deriving associated type fields without bounds Derive TypeInfo for fields with associated types without bounds Sep 9, 2020
@dvdplm
Copy link
Contributor

dvdplm commented Nov 20, 2020

Looks like this is in a pretty good state? What is still outstanding here, docs and that todo?

@ascjones
Copy link
Contributor Author

Ooh thanks for pinging this. Yeah just the things you specified there and syncing with master

derive/src/trait_bounds.rs Outdated Show resolved Hide resolved
derive/src/trait_bounds.rs Outdated Show resolved Hide resolved
@ascjones ascjones mentioned this pull request Dec 7, 2020
8 tasks
ascjones and others added 7 commits December 8, 2020 12:18
@dvdplm dvdplm marked this pull request as ready for review December 9, 2020 19:36
test_suite/tests/derive.rs Outdated Show resolved Hide resolved
test_suite/tests/derive.rs Outdated Show resolved Hide resolved
derive/src/trait_bounds.rs Outdated Show resolved Hide resolved
derive/src/trait_bounds.rs Outdated Show resolved Hide resolved
derive/src/trait_bounds.rs Outdated Show resolved Hide resolved
derive/src/trait_bounds.rs Outdated Show resolved Hide resolved
derive/src/trait_bounds.rs Show resolved Hide resolved
Copy link
Contributor Author

@ascjones ascjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval by proxy

@dvdplm dvdplm merged commit fda65f2 into master Dec 14, 2020
@dvdplm dvdplm deleted the aj-bounds branch December 14, 2020 10:03
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.

None yet

2 participants