Skip to content

Commit

Permalink
Construct PortableRegistry dynamically at runtime (#164)
Browse files Browse the repository at this point in the history
* WIP: allow constructing MetaTypes at runtime

* Remove fmt config options

* Add some docs

* std feature String

* fully qualified String

* Fix features build

* Generic string parameter for MetaType

* Remove license_template_path

* Fmt

* Fix fmt

* Replace MetaFormString trait with cfg based string

* Remove unused into

* Fix more errors

* Now string types are the same across Meta/Portable, no longer necessary to convert

* Remove custom MetaType and TypeId

* EXPERIMENT: make all type def fields public to allow construting PortableRegistry dynamically

* Rename test

* Fix up type ids in test

* Fix ui test

* *TEMPORARILY* pub registry for PortableType

* add constructor for portableregistry

* constructor for PortableType

* implement remaining constructors for generic Form

* make Type::new constructor public

* make remaining constructor public

* add a new custom constructor for path

* use new_custom in a test

* Remove not required builder fn for MetaType

* WIP propogate Form through builders

* Fix up path builders

* More fixes

* Fix up generated From impls

* Fix up field builders

* Fix up field builder methods for MetaForm

* Rename constructor

* Hide pub fields and add portable builder helper methods

* Fmt

* Explicity export PortableType

* Clippy

* Move PortableRegistry to own file, introduce PortableRegistryBuilder

* Remove some stray `Str` type params

* Implement PortableRegistryBuilder to manage ids

* Default impl for PortableRegistryBuilder

* implement getter for registered types in PortableRegistryBuilder

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>

* Rename new path constructor

* Rename new_custom methods to new_portable

* Revert reordering of MetaForm

* Move path construction back to MetaForm for non-breaking changes

* Update path tests

* TypeParameter::new_portable for non breaking change

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
Co-authored-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
  • Loading branch information
ascjones and xermicus authored Oct 7, 2022
1 parent b881bfb commit a69ac55
Show file tree
Hide file tree
Showing 15 changed files with 661 additions and 307 deletions.
3 changes: 0 additions & 3 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ format_code_in_doc_comments = false
comment_width = 80
normalize_comments = true # changed
normalize_doc_attributes = false
license_template_path = "FILE_TEMPLATE" # changed
format_strings = false
format_macro_matchers = false
format_macro_bodies = true
Expand Down Expand Up @@ -57,8 +56,6 @@ skip_children = false
hide_parse_errors = false
error_on_line_overflow = false
error_on_unformatted = false
report_todo = "Always"
report_fixme = "Always"
ignore = []

# Below are `rustfmt` internal settings
Expand Down
10 changes: 7 additions & 3 deletions derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,13 @@ impl TypeInfoImpl {
})
.collect::<Vec<_>>();

Some(quote! {
.#docs_builder_fn(&[ #( #docs ),* ])
})
if !docs.is_empty() {
Some(quote! {
.#docs_builder_fn([ #( #docs ),* ])
})
} else {
None
}
}
}

Expand Down
Loading

0 comments on commit a69ac55

Please sign in to comment.