pub struct TypeAggregator<C>where
C: CustomTypeKind<RustTypeId>,{ /* private fields */ }
Implementations§
Source§impl<C> TypeAggregator<C>where
C: CustomTypeKind<RustTypeId>,
impl<C> TypeAggregator<C>where
C: CustomTypeKind<RustTypeId>,
pub fn new() -> TypeAggregator<C>
Sourcepub fn add_root_type<T>(&mut self, name: impl Into<String>) -> LocalTypeId
pub fn add_root_type<T>(&mut self, name: impl Into<String>) -> LocalTypeId
Adds the type (and its dependencies) to the TypeAggregator
.
Also tracks it as a named root type, which can be used e.g. in schema comparisons.
This is only intended for use when adding root types to schemas,
and should not be called from inside Describe
implementations.
Sourcepub fn add_child_type_and_descendents<T>(&mut self) -> LocalTypeId
pub fn add_child_type_and_descendents<T>(&mut self) -> LocalTypeId
Adds the dependent type (and its dependencies) to the TypeAggregator
.
Sourcepub fn add_child_type(
&mut self,
type_id: RustTypeId,
get_type_data: impl FnOnce() -> TypeData<C, RustTypeId>,
) -> LocalTypeId
pub fn add_child_type( &mut self, type_id: RustTypeId, get_type_data: impl FnOnce() -> TypeData<C, RustTypeId>, ) -> LocalTypeId
Adds the type’s TypeData
to the TypeAggregator
.
If the type is well known or already in the aggregator, this returns early with the existing index.
Typically you should use add_child_type_and_descendents
, unless you’re replacing/mutating
the child types somehow. In which case, you’ll likely wish to call add_child_type
and
add_schema_descendents
separately.
Sourcepub fn add_schema_descendents<T>(&mut self) -> bool
pub fn add_schema_descendents<T>(&mut self) -> bool
Adds the type’s descendent types to the TypeAggregator
, if they’ve not already been added.
Typically you should use add_child_type_and_descendents
, unless you’re replacing/mutating
the child types somehow. In which case, you’ll likely wish to call add_child_type
and
add_schema_descendents
separately.