pub struct StructType { /* private fields */ }Expand description
DataType for a specific struct
Implementations§
Source§impl StructType
impl StructType
Sourcepub fn new(fields: Vec<StructField>) -> Self
pub fn new(fields: Vec<StructField>) -> Self
Creates a new StructType with the given fields
§Arguments
fields- Vector of StructField that define the structure
The method automatically builds a lookup table mapping field IDs to their position in the fields vector for efficient field access by ID.
Sourcepub fn builder() -> StructTypeBuilder
pub fn builder() -> StructTypeBuilder
Creates a new StructTypeBuilder to construct a StructType using the builder pattern
This is the recommended way to construct complex StructType instances when you need to add fields incrementally or conditionally.
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 Clone for StructType
impl Clone for StructType
Source§fn clone(&self) -> StructType
fn clone(&self) -> StructType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StructType
impl Debug for StructType
Source§impl<'de> Deserialize<'de> for StructType
impl<'de> Deserialize<'de> for StructType
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>,
Source§impl Index<usize> for StructType
impl Index<usize> for StructType
Source§impl PartialEq for StructType
impl PartialEq for StructType
Source§impl Serialize for StructType
impl Serialize for StructType
Source§impl TryFrom<&Fields> for StructType
impl TryFrom<&Fields> for StructType
Source§impl TryFrom<&Schema> for StructType
impl TryFrom<&Schema> for StructType
Source§impl TryInto<Fields> for &StructType
impl TryInto<Fields> for &StructType
Source§impl TryInto<Schema> for &StructType
impl TryInto<Schema> for &StructType
impl Eq for StructType
impl StructuralPartialEq for StructType
Auto Trait Implementations§
impl Freeze for StructType
impl RefUnwindSafe for StructType
impl Send for StructType
impl Sync for StructType
impl Unpin for StructType
impl UnwindSafe for StructType
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