pub struct Schema { /* private fields */ }Expand description
Names and types of fields in a table.
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn builder() -> SchemaBuilder
pub fn builder() -> SchemaBuilder
Creates a new SchemaBuilder to construct a Schema using the builder pattern
§Returns
- A SchemaBuilder instance configured with default values
This is the recommended way to construct Schema instances when you need to add fields incrementally or set optional parameters.
Sourcepub fn from_struct_type(
fields: StructType,
schema_id: i32,
identifier_field_ids: Option<Vec<i32>>,
) -> Self
pub fn from_struct_type( fields: StructType, schema_id: i32, identifier_field_ids: Option<Vec<i32>>, ) -> Self
Creates a new Schema from a StructType and associated metadata
§Arguments
fields- The StructType containing the schema’s fieldsschema_id- Unique identifier for this schemaidentifier_field_ids- Optional list of field IDs that identify rows in the table
§Returns
- A new Schema instance with the provided fields and metadata
Methods from Deref<Target = StructType>§
Sourcepub fn get(&self, index: usize) -> Option<&StructField>
pub fn get(&self, index: usize) -> Option<&StructField>
Sourcepub fn get_name(&self, name: &str) -> Option<&StructField>
pub fn get_name(&self, name: &str) -> Option<&StructField>
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of fields in this struct
§Returns
- The total count of StructFields contained in this struct
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the struct contains no fields
§Returns
trueif this struct has no fieldsfalseif this struct has at least one field
Sourcepub fn iter(&self) -> Iter<'_, StructField>
pub fn iter(&self) -> Iter<'_, StructField>
Returns an iterator over all fields in this struct
§Returns
- An iterator yielding references to each StructField in order
Sourcepub fn field_ids(&self) -> impl Iterator<Item = i32>
pub fn field_ids(&self) -> impl Iterator<Item = i32>
Returns an iterator over all field IDs in this struct, sorted in ascending order
§Returns
- An iterator yielding field IDs (i32) in sorted order
Sourcepub fn primitive_field_ids(&self) -> impl Iterator<Item = i32>
pub fn primitive_field_ids(&self) -> impl Iterator<Item = i32>
Returns an iterator over field IDs of primitive-type fields only, sorted in ascending order
This method filters the struct’s fields to return only those with primitive types (boolean, numeric, string, etc.), excluding complex types like structs, lists, and maps.
§Returns
- An iterator yielding field IDs (i32) of primitive fields in sorted order
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Schema
impl<'de> Deserialize<'de> for Schema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Schema
impl StructuralPartialEq for Schema
Auto Trait Implementations§
impl Freeze for Schema
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnwindSafe for Schema
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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