Struct typify_impl::TypeSpace
source · [−]pub struct TypeSpace { /* private fields */ }Expand description
A collection of types.
Implementations
sourceimpl TypeSpace
impl TypeSpace
sourcepub fn new(settings: &TypeSpaceSettings) -> Self
pub fn new(settings: &TypeSpaceSettings) -> Self
Create a new TypeSpace with custom settings
sourcepub fn add_ref_types<I, S>(&mut self, type_defs: I) -> Result<()>where
I: IntoIterator<Item = (S, Schema)>,
S: AsRef<str>,
pub fn add_ref_types<I, S>(&mut self, type_defs: I) -> Result<()>where
I: IntoIterator<Item = (S, Schema)>,
S: AsRef<str>,
Add a collection of types that will be used as references. Regardless of how these types are defined–de novo or built-in–each type will appear in the final output as a struct, enum or newtype. This method may be called multiple times, but collections of references must be self-contained; in other words, a type in one invocation may not refer to a type in another invocation.
sourcepub fn add_type(&mut self, schema: &Schema) -> Result<TypeId>
pub fn add_type(&mut self, schema: &Schema) -> Result<TypeId>
Add a new type and return a type identifier that may be used in function signatures or embedded within other types.
sourcepub fn add_type_with_name(
&mut self,
schema: &Schema,
name_hint: Option<String>
) -> Result<TypeId>
pub fn add_type_with_name(
&mut self,
schema: &Schema,
name_hint: Option<String>
) -> Result<TypeId>
Add a new type with a name hint and return a the components necessary to use the type for various components of a function signature.
pub fn uses_chrono(&self) -> bool
pub fn uses_regress(&self) -> bool
pub fn uses_serde_json(&self) -> bool
pub fn uses_uuid(&self) -> bool
sourcepub fn iter_types(&self) -> impl Iterator<Item = Type<'_>>
pub fn iter_types(&self) -> impl Iterator<Item = Type<'_>>
Iterate over all types including those defined in this TypeSpace and those referred to by those types.
sourcepub fn common_code(&self) -> TokenStream
pub fn common_code(&self) -> TokenStream
Common code, shared by types.
sourcepub fn to_stream(&self) -> TokenStream
pub fn to_stream(&self) -> TokenStream
All code for processed types.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for TypeSpace
impl Send for TypeSpace
impl Sync for TypeSpace
impl Unpin for TypeSpace
impl UnwindSafe for TypeSpace
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more