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
true
if this struct has no fieldsfalse
if 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
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>,
Deserialize this value from the given Serde deserializer. Read more
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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