Schema

Struct Schema 

Source
pub struct Schema { /* private fields */ }
Expand description

Names and types of fields in a table.

Implementations§

Source§

impl Schema

Auto-generated by derive_getters::Getters.

Source

pub fn schema_id(&self) -> &i32

Identifier of the schema

Source

pub fn identifier_field_ids(&self) -> &Option<Vec<i32>>

Set of primitive fields that identify rows in a table.

Source

pub fn fields(&self) -> &StructType

The struct fields

Source§

impl Schema

Source

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.

Source

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 fields
  • schema_id - Unique identifier for this schema
  • identifier_field_ids - Optional list of field IDs that identify rows in the table
§Returns
  • A new Schema instance with the provided fields and metadata
Source

pub fn project(&self, ids: &[i32]) -> Schema

Creates a new Schema containing only the specified field IDs

§Arguments
  • ids - Array of field IDs to include in the projected schema
§Returns
  • A new Schema containing only the specified fields, maintaining the original schema ID and any identifier fields that were included in the projection

Methods from Deref<Target = StructType>§

Source

pub fn get(&self, index: usize) -> Option<&StructField>

Gets a reference to the StructField at the given index

§Arguments
  • index - The index of the field to retrieve
§Returns
  • Some(&StructField) if a field exists at that index
  • None if no field exists at that index
Source

pub fn get_name(&self, name: &str) -> Option<&StructField>

Gets a reference to the StructField with the given name

§Arguments
  • name - The name of the field to retrieve
§Returns
  • Some(&StructField) if a field with the given name exists
  • None if no field with that name exists
Source

pub fn len(&self) -> usize

Returns the number of fields in this struct

§Returns
  • The total count of StructFields contained in this struct
Source

pub fn is_empty(&self) -> bool

Returns true if the struct contains no fields

§Returns
  • true if this struct has no fields
  • false if this struct has at least one field
Source

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
Source

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
Source

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 Schema

Source§

fn clone(&self) -> Schema

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Schema

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for Schema

Source§

type Target = StructType

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'de> Deserialize<'de> for Schema

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Schema

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Schema> for SchemaV1

Source§

fn from(value: Schema) -> Self

Converts to this type from the input type.
Source§

impl From<Schema> for SchemaV2

Source§

fn from(value: Schema) -> Self

Converts to this type from the input type.
Source§

impl FromStr for Schema

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl PartialEq for Schema

Source§

fn eq(&self, other: &Schema) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Schema

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<SchemaV1> for Schema

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: SchemaV1) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<SchemaV2> for Schema

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: SchemaV2) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Eq for Schema

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T