pub struct TypeSchemaBuilder { /* private fields */ }Expand description
Builder for creating type schemas fluently
Implementations§
Source§impl TypeSchemaBuilder
impl TypeSchemaBuilder
Sourcepub fn decimal_field(self, name: impl Into<String>) -> Self
pub fn decimal_field(self, name: impl Into<String>) -> Self
Add a decimal field (stored as f64, reconstructed as Decimal on read)
Sourcepub fn bool_field(self, name: impl Into<String>) -> Self
pub fn bool_field(self, name: impl Into<String>) -> Self
Add a boolean field
Sourcepub fn string_field(self, name: impl Into<String>) -> Self
pub fn string_field(self, name: impl Into<String>) -> Self
Add a string field
Sourcepub fn timestamp_field(self, name: impl Into<String>) -> Self
pub fn timestamp_field(self, name: impl Into<String>) -> Self
Add a timestamp field
Sourcepub fn object_field(
self,
name: impl Into<String>,
type_name: impl Into<String>,
) -> Self
pub fn object_field( self, name: impl Into<String>, type_name: impl Into<String>, ) -> Self
Add a nested object field
Sourcepub fn array_field(
self,
name: impl Into<String>,
element_type: FieldType,
) -> Self
pub fn array_field( self, name: impl Into<String>, element_type: FieldType, ) -> Self
Add an array field
Sourcepub fn field_with_meta(
self,
name: impl Into<String>,
field_type: FieldType,
annotations: Vec<FieldAnnotation>,
) -> Self
pub fn field_with_meta( self, name: impl Into<String>, field_type: FieldType, annotations: Vec<FieldAnnotation>, ) -> Self
Add a field with annotation metadata
Sourcepub fn build(self) -> TypeSchema
pub fn build(self) -> TypeSchema
Build the type schema
Sourcepub fn register(self, registry: &mut TypeSchemaRegistry) -> SchemaId
pub fn register(self, registry: &mut TypeSchemaRegistry) -> SchemaId
Build and register in a registry, using the registry’s per-instance schema-ID counter.
Since B1.7 this path must not consult current_registry, because
DEFAULT_SCHEMA_REGISTRY is itself initialized via this builder
and that would cause a recursive LazyLock init. Allocating
directly from the target registry keeps bootstrap deterministic
and per-registry isolated.
Auto Trait Implementations§
impl Freeze for TypeSchemaBuilder
impl RefUnwindSafe for TypeSchemaBuilder
impl Send for TypeSchemaBuilder
impl Sync for TypeSchemaBuilder
impl Unpin for TypeSchemaBuilder
impl UnsafeUnpin for TypeSchemaBuilder
impl UnwindSafe for TypeSchemaBuilder
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
Mutably borrows from an owned value. Read more