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.
pub fn generate_type_collection_schema<S>(self) -> TypeCollectionSchema<S>where
S: CustomSchema<CustomAggregatorTypeKind = C>,
Auto Trait Implementations§
impl<C> Freeze for TypeAggregator<C>
impl<C> RefUnwindSafe for TypeAggregator<C>
impl<C> Send for TypeAggregator<C>
impl<C> Sync for TypeAggregator<C>
impl<C> Unpin for TypeAggregator<C>
impl<C> UnwindSafe for TypeAggregator<C>
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
Source§impl<T, U> ContextualTryInto<U> for Twhere
U: ContextualTryFrom<T>,
impl<T, U> ContextualTryInto<U> for Twhere
U: ContextualTryFrom<T>,
type Error = <U as ContextualTryFrom<T>>::Error
type Context = <U as ContextualTryFrom<T>>::Context
fn contextual_try_into( self, context: &<U as ContextualTryFrom<T>>::Context, ) -> Result<U, <U as ContextualTryFrom<T>>::Error>
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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> ⓘ
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> ⓘ
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 more